mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Code review changes
This commit is contained in:
@@ -1714,6 +1714,11 @@ App::patch('/v1/account/sessions/:sessionId')
|
||||
$appSecret = $project->getAttribute('providers', [])[$provider.'Secret'] ?? '{}';
|
||||
|
||||
$className = 'Appwrite\\Auth\\OAuth2\\'.\ucfirst($provider);
|
||||
|
||||
if (!\class_exists($className)) {
|
||||
throw new Exception('Provider is not supported', 501);
|
||||
}
|
||||
|
||||
$oauth2 = new $className($appId, $appSecret, '', [], []);
|
||||
|
||||
$oauth2->refreshTokens($refreshToken);
|
||||
|
||||
@@ -124,7 +124,7 @@ abstract class OAuth2
|
||||
public function getAccessToken(string $code):string
|
||||
{
|
||||
$tokens = $this->getTokens($code);
|
||||
return $tokens['access_token'];
|
||||
return $tokens['access_token'] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ abstract class OAuth2
|
||||
public function getRefreshToken(string $code):string
|
||||
{
|
||||
$tokens = $this->getTokens($code);
|
||||
return $tokens['refresh_token'];
|
||||
return $tokens['refresh_token'] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ abstract class OAuth2
|
||||
public function getAccessTokenExpiry(string $code):string
|
||||
{
|
||||
$tokens = $this->getTokens($code);
|
||||
return $tokens['expires_in'];
|
||||
return $tokens['expires_in'] ?? '';
|
||||
}
|
||||
|
||||
// The parseState function was designed specifically for Amazon OAuth2 Adapter to override.
|
||||
|
||||
Reference in New Issue
Block a user