ParseAndVerify parses and verifies the token and returns the claims. See Verify for the verification process.
(ctx context.Context, token *oauth2.Token, keyProvider PublicKeyProvider, issuer, audience string)
| 175 | // ParseAndVerify parses and verifies the token and returns the claims. |
| 176 | // See Verify for the verification process. |
| 177 | func ParseAndVerify(ctx context.Context, token *oauth2.Token, keyProvider PublicKeyProvider, issuer, audience string) (TokenClaims, error) { |
| 178 | t, err := jwt.ParseSigned(token.AccessToken) |
| 179 | if err != nil { |
| 180 | return TokenClaims{}, errOAuth2Token.WithCause(err) |
| 181 | } |
| 182 | return Verify(ctx, t, keyProvider, issuer, audience) |
| 183 | } |
| 184 | |
| 185 | // Verify verifies the token and returns the claims. |
| 186 | // If issuer is non-empty, the token's issuer must match the issuer. |