1.17.8 (latest) 1.17.7 1.16.2 1.15.1 1.14.0 1.13.1 1.12.2 Reference documentation and code samples for the googleauth class Google::Auth::IDTokens::Verifier.

An object that can verify ID tokens.


<br />

A verifier maintains a set of default settings, including the key
source and fields to verify. However, individual verification calls can
override any of these settings.

## Inherits

- Object

## Methods

### #initialize

```ruby
def initialize(key_source: nil, aud: nil, azp: nil, iss: nil) -> Verifier
```
Create a verifier.
**Parameters**

- **key_source** (key source) *(defaults to: nil)* --- The default key source to use. All verification calls must have a key source, so if no default key source is provided here, then calls to [#verify](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-Verifier.md.txt#Google__Auth__IDTokens__Verifier_verify_instance_ "Google::Auth::IDTokens::Verifier#verify (method)") *must* provide a key source.
- **aud** (String, nil) *(defaults to: nil)* --- The default audience (`aud`) check, or `nil` for no check.
- **azp** (String, nil) *(defaults to: nil)* --- The default authorized party (`azp`) check, or `nil` for no check.
- **iss** (String, nil) *(defaults to: nil)* --- The default issuer (`iss`) check, or `nil` for no check.
**Returns**

- ([Verifier](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-Verifier.md.txt)) --- a new instance of Verifier

### #verify

```ruby
def verify(token, key_source: :default, aud: :default, azp: :default, iss: :default) -> Hash
```
Verify the given token.
**Parameters**

- **token** (String) --- the ID token to verify.
- **key_source** (key source) *(defaults to: :default)* --- If given, override the key source.
- **aud** (String, nil) *(defaults to: :default)* --- If given, override the `aud` check.
- **azp** (String, nil) *(defaults to: :default)* --- If given, override the `azp` check.
- **iss** (String, nil) *(defaults to: :default)* --- If given, override the `iss` check.
**Returns**

- (Hash) --- the decoded payload, if verification succeeded.
**Raises**

- ([Google::Auth::IDTokens::KeySourceError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-KeySourceError.md.txt)) --- if the key source failed to obtain public keys
- ([Google::Auth::IDTokens::VerificationError](https://docs.cloud.google.com/ruby/docs/reference/googleauth/latest/Google-Auth-IDTokens-VerificationError.md.txt)) --- if the token verification failed. Additional data may be available in the error subclass and message.