# Class: AccessToken

## vertx-auth-oauth2-js/access_token~ AccessToken

#### new AccessToken()

AccessToken extension to the User interface

Source:
  - vertx-auth-oauth2-js/access_token.js, line 33

### Methods

#### accessToken() → {Object}

The Access Token if present parsed as a JsonObject

Source:
  - vertx-auth-oauth2-js/access_token.js, line 141

##### Returns:

JSON

Type
  Object

#### clearCache() → {User}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 87

##### Returns:

Type
  User

#### expired() → {boolean}

Check if the access token is expired or not.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 127

##### Returns:

Type
  boolean

#### fetch(method, resource, headers, payload, callback) → {AccessToken}

Fetches a JSON resource using this Access Token.

##### Parameters:

Name | Type | Description
--- | --- | ---
`method` | Object | the HTTP method to user.
`resource` | string | the resource to fetch.
`headers` | Object | extra headers to pass to the request.
`payload` | Buffer | payload to send to the server.
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 370

##### Returns:

Type
  AccessToken

#### idToken() → {Object}

The Id Token if present parsed as a JsonObject

Source:
  - vertx-auth-oauth2-js/access_token.js, line 169

##### Returns:

JSON

Type
  Object

#### introspect(tokenType, callback) → {AccessToken}

Introspect access token. This is an OAuth2 extension that allow to verify if an access token is still valid.

##### Parameters:

Name | Type | Description
--- | --- | ---
`tokenType` | string | A String containing the type of token to revoke. Should be either "access_token" or "refresh_token".
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 315

##### Returns:

Type
  AccessToken

#### isAuthorised(authority, resultHandler) → {User}

##### Parameters:

Name | Type | Description
--- | --- | ---
`authority` | string |
`resultHandler` | function |

Source:
  - vertx-auth-oauth2-js/access_token.js, line 67

##### Returns:

Type
  User

#### isAuthorized(arg0, arg1) → {User}

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | string |
`arg1` | function |

Source:
  - vertx-auth-oauth2-js/access_token.js, line 46

##### Returns:

Type
  User

#### logout(callback) → {AccessToken}

Revoke refresh token and calls the logout endpoint. This is a openid-connect extension and might not be available on all providers.

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 293

##### Returns:

Type
  AccessToken

#### opaqueAccessToken() → {string}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 182

##### Returns:

Type
  string

#### opaqueIdToken() → {string}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 208

##### Returns:

Type
  string

#### opaqueRefreshToken() → {string}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 195

##### Returns:

Type
  string

#### principal() → {Object}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 101

##### Returns:

Type
  Object

#### refresh(callback) → {AccessToken}

Refresh the access token

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 249

##### Returns:

Type
  AccessToken

#### refreshToken() → {Object}

The Refresh Token if present parsed as a JsonObject

Source:
  - vertx-auth-oauth2-js/access_token.js, line 155

##### Returns:

JSON

Type
  Object

#### revoke(token_type, callback) → {AccessToken}

Revoke access or refresh token

##### Parameters:

Name | Type | Description
--- | --- | ---
`token_type` | string | A String containing the type of token to revoke. Should be either "access_token" or "refresh_token".
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 271

##### Returns:

Type
  AccessToken

#### setAuthProvider(arg0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | AuthProvider |

Source:
  - vertx-auth-oauth2-js/access_token.js, line 113

#### setTrustJWT(trust) → {AccessToken}

##### Parameters:

Name | Type | Description
--- | --- | ---
`trust` | boolean |

Source:
  - vertx-auth-oauth2-js/access_token.js, line 234

##### Returns:

Type
  AccessToken

#### tokenType() → {string}

Source:
  - vertx-auth-oauth2-js/access_token.js, line 221

##### Returns:

Type
  string

#### userInfo(callback) → {AccessToken}

Load the user info as per OIDC spec.

##### Parameters:

Name | Type | Description
--- | --- | ---
`callback` | function | The callback function returning the results.

Source:
  - vertx-auth-oauth2-js/access_token.js, line 345

##### Returns:

Type
  AccessToken