mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 09:47:46 +05:30
Handle no scope hint
This commit is contained in:
parent
9273936009
commit
2765481b9f
@ -105,10 +105,15 @@ class OAuthServerException extends \Exception
|
|||||||
public static function invalidScope($scope, $redirectUri = null)
|
public static function invalidScope($scope, $redirectUri = null)
|
||||||
{
|
{
|
||||||
$errorMessage = 'The requested scope is invalid, unknown, or malformed';
|
$errorMessage = 'The requested scope is invalid, unknown, or malformed';
|
||||||
|
|
||||||
|
if (empty($scope)) {
|
||||||
|
$hint = 'Specify a scope in the request or set a default scope';
|
||||||
|
} else {
|
||||||
$hint = sprintf(
|
$hint = sprintf(
|
||||||
'Check the `%s` scope',
|
'Check the `%s` scope',
|
||||||
htmlspecialchars($scope, ENT_QUOTES, 'UTF-8', false)
|
htmlspecialchars($scope, ENT_QUOTES, 'UTF-8', false)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return new static($errorMessage, 5, 'invalid_scope', 400, $hint, $redirectUri);
|
return new static($errorMessage, 5, 'invalid_scope', 400, $hint, $redirectUri);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user