Global - Documentation

# Global

##

### Methods

#### decode(token) → {DecodedToken}

Decodes a well formed JWT without any verification

Source:
  - index.js, line 214

##### Parameters:

Name | Type | Description
--- | --- | ---
`token` | `String` | decodes the token

##### Returns:

Type:
  `DecodedToken`

if token is valid according to `exp` and `nbf`

#### verify(token, nonceopt, cb)

Verifies an id_token

It will validate:

- signature according to the algorithm configured in the verifier.
- if nonce is present and matches the one provided
- if `iss` and `aud` claims matches the configured issuer and audience
- if token is not expired and valid (if the `nbf` claim is in the past)

Source:
  - index.js, line 48

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`token` | `String` |  | id_token to verify
`nonce` | `String` | <optional> | nonce value that should match the one in the id_token claims
`cb` | `verifyCallback` |  | callback used to notify the results of the validation

#### verifyExpAndIat(exp, iat) → {boolean}

Verifies that the `exp` and `iat` claims are valid in the current moment.

Source:
  - index.js, line 152

##### Parameters:

Name | Type | Description
--- | --- | ---
`exp` | `String` | value of `exp` claim
`iat` | `String` | value of `iat` claim

##### Returns:

Type:
  `boolean`

if token is valid according to `exp` and `iat`

#### verifyExpAndNbf(exp, nbf) → {boolean}

Verifies that the `exp` and `nbf` claims are valid in the current moment.

Source:
  - index.js, line 117

##### Parameters:

Name | Type | Description
--- | --- | ---
`exp` | `String` | value of `exp` claim
`nbf` | `String` | value of `nbf` claim

##### Returns:

Type:
  `boolean`

if token is valid according to `exp` and `nbf`

### Type Definitions

#### DecodedToken

##### Properties:

Name | Type | Description
--- | --- | ---
`header` | `Object` | content of the JWT header.
`payload` | `Object` | token claims.
`encoded` | `Object` | encoded parts of the token.

Source:
  - index.js, line 206

##### Type:

- `Object`

#### verifyCallback(erropt, statusopt)

Source:
  - index.js, line 42

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`err` | `Error` | <optional> | error returned if the verify cannot be performed
`status` | `boolean` | <optional> | if the token is valid or not