# Class: OAuth2Auth

## vertx-auth-oauth2-js/o_auth2_auth~ OAuth2Auth

#### new OAuth2Auth()

Source:
  - vertx-auth-oauth2-js/o_auth2_auth.js, line 32

### Methods

#### api(method, path, params, handler) → {OAuth2Auth}

Call OAuth2 APIs.

##### Parameters:

Name | Type | Description
--- | --- | ---
`method` | Object | HttpMethod
`path` | string | target path
`params` | Object | parameters
`handler` | function | handler

Source:
  - vertx-auth-oauth2-js/o_auth2_auth.js, line 82

##### Returns:

self

Type
  OAuth2Auth

#### authorizeURL(params) → {string}

Generate a redirect URL to the authN/Z backend. It only applies to auth_code flow.

##### Parameters:

Name | Type | Description
--- | --- | ---
`params` | Object |

Source:
  - vertx-auth-oauth2-js/o_auth2_auth.js, line 45

##### Returns:

Type
  string

#### getToken(params, handler)

Returns the Access Token object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`params` | Object | JSON with the options, each flow requires different options.
`handler` | function | The handler returning the results.

Source:
  - vertx-auth-oauth2-js/o_auth2_auth.js, line 59

#### hasJWTToken() → {boolean}

Returns true if this provider supports JWT tokens as the access_token. This is typically true if the provider implements the `openid-connect` protocol. This is a plain return from the config option jwtToken, which is false by default. This information is important to validate grants. Since pure OAuth2 should be used for authorization and when a token is requested all grants should be declared, in case of openid-connect this is not true. OpenId will issue a token and all grants will be encoded on the token itself so the requester does not need to list the required grants.

Source:
  - vertx-auth-oauth2-js/o_auth2_auth.js, line 110

##### Returns:

true if openid-connect is used.

Type
  boolean