Passport: How to get authenticated client by Client Credentials Grant ?

Created on 27 Oct 2017  路  3Comments  路  Source: laravel/passport

Like the file CheckClientCredentials.php

 /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  mixed  ...$scopes
     * @return mixed
     * @throws \Illuminate\Auth\AuthenticationException
     */
    public function handle($request, Closure $next, ...$scopes)
    {
        $psr = (new DiactorosFactory)->createRequest($request);
        try {
            $psr = $this->server->validateAuthenticatedRequest($psr);
        } catch (OAuthServerException $e) {
            throw new AuthenticationException;
        }
        $this->validateScopes($psr, $scopes);
        return $next($request);
    }

why not add $psr to $request object when get authenticated client id in controller, like this

 $psr = $this->server->validateAuthenticatedRequest($psr);

$request->client = $psr
enhancement

Most helpful comment

Heya, thanks for sending this in. I agree that this can be useful. I've marked this as a feature request. Feel free to send in a PR to master.

All 3 comments

this is a avaliable function
https://github.com/laravel/passport/issues/124

Heya, thanks for sending this in. I agree that this can be useful. I've marked this as a feature request. Feel free to send in a PR to master.

I'm going to close this as this is a duplicate of https://github.com/laravel/passport/issues/143. Please follow the discussion there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seriousjelly picture seriousjelly  路  3Comments

rudolfdobias picture rudolfdobias  路  3Comments

mehrancodes picture mehrancodes  路  3Comments

gbgelado picture gbgelado  路  3Comments

soubhikchatterjee picture soubhikchatterjee  路  4Comments