Added missing state param

This commit is contained in:
Eldad Fux 2020-01-13 22:59:53 +02:00
parent ef597bbd9d
commit c5df0627bd

View file

@ -19,10 +19,12 @@ class Discord extends OAuth
*/ */
protected $user = []; protected $user = [];
/**
* @var array
*/
protected $scope = [ protected $scope = [
'identify', 'identify',
'email' 'email'
]; ];
/** /**
@ -43,7 +45,8 @@ class Discord extends OAuth
'response_type' => 'code', 'response_type' => 'code',
'client_id' => $this->appID, 'client_id' => $this->appID,
'scope' => implode(' ', $this->scope), 'scope' => implode(' ', $this->scope),
'redirect_uri' => $this->callback 'state' => json_encode($this->state),
'redirect_uri' => $this->callback,
]); ]);
return $url; return $url;
@ -70,10 +73,8 @@ class Discord extends OAuth
]) ])
); );
$accessToken = json_decode($accessToken, true); $accessToken = json_decode($accessToken, true);
if (isset($accessToken['access_token'])) { if (isset($accessToken['access_token'])) {
return $accessToken['access_token']; return $accessToken['access_token'];
} }