src/A1comms/GaeSupportLaravel/Auth/Token/OAuth2.php
/**
     * Validate an OAuth2 access_token.
     *
     * @param string The access_token to validate.
     *
     * @throws \A1comms\GaeSupportLaravel\Auth\Exception\InvalidTokenException if the token is invalid.
     *
     * @return array Returns decoded token information from the tokeninfo endpoint.
     */




@return array Returns decoded token information from the tokeninfo endpoint.
@return array Returns decoded token information from the tokeninfo endpoint .
public static function validateToken($token)
    {
        $response = null;
        try {
            $clientParams = [
                'allow_redirects'   => false,
                'connect_timeout'   => self::VALIDATE_CONNECTION_TIMEOUT_S,
                'timeout'           => self::VALIDATE_REQUEST_TIMEOUT_S,
            ];
            $client = new Client($clientParams);
            $response = $client->get(
                self::TOKENINFO_ENDPOINT_URI . '?access_token=' . $token
            );
            $response = json_decode($response->getBody(), true);
        } catch (Exception $e) {
            throw new InvalidTokenException("Access Token Validation Exception: Remote Token Check Failed");
        }
        return $response;
    }
public static function validateToken ( $ token ) { $ response = null ; try { $ clientParams = [ 'allow_redirects' => false , 'connect_timeout' => self :: VALIDATE_CONNECTION_TIMEOUT_S , 'timeout' => self :: VALIDATE_REQUEST_TIMEOUT_S , ] ; $ client = new Client ( $ clientParams ) ; $ response = $ client -> get ( self :: TOKENINFO_ENDPOINT_URI . '?access_token=' . $ token ) ; $ response = json_decode ( $ response -> getBody ( ) , true ) ; } catch ( Exception $ e ) { throw new InvalidTokenException ( " Access Token Validation Exception: Remote Token Check Failed " ) ; } return $ response ; }
Validate an OAuth2 access_token.
Validate an OAuth2 access_token .
// create the HTTP client // make the request