The token is returned (as an associative array) if valid.
The scope parameter defines any required scope that the token must have.
If a scope param is provided and the token does not have the required
scope, we bounce the request.
Some implementations may choose to return a subset of the protected
resource (i.e. "public" data) if the user has not provided an access
token or if the access token is invalid or expired.
The IETF spec says that we should send a 401 Unauthorized header and
bail immediately so that's what the defaults are set to. You can catch
the exception thrown and behave differently if you like (log errors, allow
public access for missing tokens, etc)
public verifyAccessToken ( string $tokenParam, string $scope = null ) : OAuth2\Model\IOAuth2AccessToken | ||
$tokenParam | string | |
$scope | string | A space-separated string of required scope(s), if you want to check for scope. |
return | OAuth2\Model\IOAuth2AccessToken | Token |