return OAUTH_PARAMETER_ABSENT;
}
- $token = $this->tokens->load('access', $provider->token);
+ try {
+ $token = $this->tokens->load('access', $provider->token);
+ } catch (OAuthException $e) {
+ if ($e->getCode() == OAUTH_TOKEN_REJECTED) {
+ return OAUTH_TOKEN_REJECTED;
+ }
+ throw $e;
+ }
$provider->token_secret = $token->secret;
return OAUTH_OK;
}
)->fetchRow();
if ($tokenRow === false) {
- throw new OAuthException('Unknown token: ' . $type . ' / ' . $tokenKey);
+ throw new OAuthException(
+ 'Unknown token: ' . $type . ' / ' . $tokenKey,
+ OAUTH_TOKEN_REJECTED
+ );
}
$token = $this->fromDb($tokenRow);
if ($token->tokenKey != $tokenKey) {
- throw new OAuthException('Invalid token');
+ throw new OAuthException('Invalid token', OAUTH_TOKEN_REJECTED);
}
return $token;