public function decode($jwt)
    {
        $wellKnown = $this->getWellKnown();
        $key = $this->getPublicKey();
        $decodedObject = JWT::decode(
            $jwt,
            $key,
            $wellKnown->id_token_signing_alg_values_supported
        );

        //Firebase\JWT\JWT::decode does not verify that some required
        //fields actually exist
        if (empty($decodedObject->iss)) {
            throw new NoIssuerException('No issuer in JWT');
        }
        if ($decodedObject->iss != $wellKnown->issuer) {
            throw new BadIssuerException('JWT issuer does not match well-known');
        }
        if (empty($decodedObject->exp)) {
            //Firebase\JWT\JWT does throw an exception if 'exp' field is in
            //the past, but not if it's completely missing
            throw new NoExpirationException('No expiration in JWT');
        }

        //JWT::decode returns at stdClass object, but iterating through keys is much
        //simpler with an array. So here's a quick Object-to-Array conversion
        $decoded = json_decode(json_encode($decodedObject), true);

        return $this->parseClaims($decoded);
    }
public function decode($jwt)
    {
        $wellKnown = $this->getWellKnown();
        $key = $this->getPublicKey();
        $decodedObject = JWT::decode(
            $jwt,
            $key,
            $wellKnown->id_token_signing_alg_values_supported
        );

        //Firebase\JWT\JWT::decode does not verify that some required
        //fields actually exist
        if (empty($decodedObject->iss)) {
            throw new NoIssuerException('No issuer in JWT');
        }
        if ($decodedObject->iss != $wellKnown->issuer) {
            throw new BadIssuerException('JWT issuer does not match well-known');
        }
        if (empty($decodedObject->exp)) {
            //Firebase\JWT\JWT does throw an exception if 'exp' field is in
            //the past, but not if it's completely missing
            throw new NoExpirationException('No expiration in JWT');
        }

        //JWT::decode returns at stdClass object, but iterating through keys is much
        //simpler with an array. So here's a quick Object-to-Array conversion
        $decoded = json_decode(json_encode($decodedObject), true);

        return $this->parseClaims($decoded);
    }
public function decode ( $ jwt ) { $ wellKnown = $ this -> getWellKnown ( ) ; $ key = $ this -> getPublicKey ( ) ; $ decodedObject = JWT :: decode ( $ jwt , $ key , $ wellKnown -> id_token_signing_alg_values_supported ) ; //Firebase\JWT\JWT::decode does not verify that some required //fields actually exist if ( empty ( $ decodedObject -> iss ) ) { throw new NoIssuerException ( 'No issuer in JWT' ) ; } if ( $ decodedObject -> iss != $ wellKnown -> issuer ) { throw new BadIssuerException ( 'JWT issuer does not match well-known' ) ; } if ( empty ( $ decodedObject -> exp ) ) { //Firebase\JWT\JWT does throw an exception if 'exp' field is in //the past, but not if it's completely missing throw new NoExpirationException ( 'No expiration in JWT' ) ; } //JWT::decode returns at stdClass object, but iterating through keys is much //simpler with an array. So here's a quick Object-to-Array conversion $ decoded = json_decode ( json_encode ( $ decodedObject ) , true ) ; return $ this -> parseClaims ( $ decoded ) ; }
Decode a JWT

@param string $jwt JWT

@return object decoded JWT

@throws Exception Various exceptions for various problems with JWT
(see Firebase\JWT\JWT::decode for details)
Decode a JWT