public function validateAccessToken($accessToken)
    {
        $keys        = $this->getJwtVerificationKeys();
        $tokenClaims = (array)JWT::decode($accessToken, $keys, ['RS256']);

        if ($this->getClientId() != $tokenClaims['aud'] && $this->getClientId() != $tokenClaims['appid']) {
            throw new \RuntimeException('The client_id / audience is invalid!');
        }
        if ($tokenClaims['nbf'] > time() || $tokenClaims['exp'] < time()) {
            // Additional validation is being performed in firebase/JWT itself
            throw new \RuntimeException('The id_token is invalid!');
        }

        if ('common' == $this->tenant) {
            $this->tenant = $tokenClaims['tid'];

            $tenant = $this->getTenantDetails($this->tenant);
            if ($tokenClaims['iss'] != $tenant['issuer']) {
                throw new \RuntimeException('Invalid token issuer!');
            }
        } else {
            $tenant = $this->getTenantDetails($this->tenant);
            if ($tokenClaims['iss'] != $tenant['issuer']) {
                throw new \RuntimeException('Invalid token issuer!');
            }
        }

        return $tokenClaims;
    }
public function validateAccessToken($accessToken)
    {
        $keys        = $this->getJwtVerificationKeys();
        $tokenClaims = (array)JWT::decode($accessToken, $keys, ['RS256']);

        if ($this->getClientId() != $tokenClaims['aud'] && $this->getClientId() != $tokenClaims['appid']) {
            throw new \RuntimeException('The client_id / audience is invalid!');
        }
        if ($tokenClaims['nbf'] > time() || $tokenClaims['exp'] < time()) {
            // Additional validation is being performed in firebase/JWT itself
            throw new \RuntimeException('The id_token is invalid!');
        }

        if ('common' == $this->tenant) {
            $this->tenant = $tokenClaims['tid'];

            $tenant = $this->getTenantDetails($this->tenant);
            if ($tokenClaims['iss'] != $tenant['issuer']) {
                throw new \RuntimeException('Invalid token issuer!');
            }
        } else {
            $tenant = $this->getTenantDetails($this->tenant);
            if ($tokenClaims['iss'] != $tenant['issuer']) {
                throw new \RuntimeException('Invalid token issuer!');
            }
        }

        return $tokenClaims;
    }
public function validateAccessToken ( $ accessToken ) { $ keys = $ this -> getJwtVerificationKeys ( ) ; $ tokenClaims = ( array ) JWT :: decode ( $ accessToken , $ keys , [ 'RS256' ] ) ; if ( $ this -> getClientId ( ) != $ tokenClaims [ 'aud' ] && $ this -> getClientId ( ) != $ tokenClaims [ 'appid' ] ) { throw new \ RuntimeException ( 'The client_id / audience is invalid!' ) ; } if ( $ tokenClaims [ 'nbf' ] > time ( ) || $ tokenClaims [ 'exp' ] < time ( ) ) { // Additional validation is being performed in firebase/JWT itself throw new \ RuntimeException ( 'The id_token is invalid!' ) ; } if ( 'common' == $ this -> tenant ) { $ this -> tenant = $ tokenClaims [ 'tid' ] ; $ tenant = $ this -> getTenantDetails ( $ this -> tenant ) ; if ( $ tokenClaims [ 'iss' ] != $ tenant [ 'issuer' ] ) { throw new \ RuntimeException ( 'Invalid token issuer!' ) ; } } else { $ tenant = $ this -> getTenantDetails ( $ this -> tenant ) ; if ( $ tokenClaims [ 'iss' ] != $ tenant [ 'issuer' ] ) { throw new \ RuntimeException ( 'Invalid token issuer!' ) ; } } return $ tokenClaims ; }
Validate the access token you received in your application.

@param $accessToken string The access token you received in the authorization header.

@return array
Validate the access token you received in your application .