/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $scopesString * * @throws \League\OAuth2\Server\Exception\InvalidScopeException * * @return mixed */ public function handle($request, Closure $next, $scopesString = null) { $scopes = []; if (!is_null($scopesString)) { $scopes = explode('+', $scopesString); } $this->authorizer->setRequest($request); $this->authorizer->validateAccessToken($this->httpHeadersOnly); $this->validateScopes($scopes); return $next($request); }