PHP code example of mikemclin / passport-custom-request-grant

1. Go to this page and download the library: Download mikemclin/passport-custom-request-grant library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mikemclin / passport-custom-request-grant example snippets


/**
 * Verify and retrieve user by custom token request.
 *
 * @param \Illuminate\Http\Request $request
 *
 * @return \Illuminate\Database\Eloquent\Model|null
 * @throws \League\OAuth2\Server\Exception\OAuthServerException
 */
public function byPassportCustomRequest(Request $request)
{
    try {
        if ($request->get('sso_token')) {
            return $this->bySsoToken($request->get('sso_token'));
        }
    } catch (\Exception $e) {
        throw OAuthServerException::accessDenied($e->getMessage());
    }
    return null;
}