# Class: OAuth2AuthHandler

## vertx-web-js/o_auth2_auth_handler~ OAuth2AuthHandler

#### new OAuth2AuthHandler()

An auth handler that provides OAuth2 Authentication support. This handler is suitable for AuthCode flows.

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 33

### Methods

#### addAuthorities(authorities) → {AuthHandler}

Add a set of required authorities for this auth handler

##### Parameters:

Name | Type | Description
--- | --- | ---
`authorities` | Array.<string> | the set of authorities

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 73

##### Returns:

a reference to this, so the API can be used fluently

Type
  AuthHandler

#### addAuthority(authority) → {AuthHandler}

Add a required authority for this auth handler

##### Parameters:

Name | Type | Description
--- | --- | ---
`authority` | string | the authority

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 58

##### Returns:

a reference to this, so the API can be used fluently

Type
  AuthHandler

#### authURI(redirectURL, state) → {string}

Build the authorization URL.

##### Parameters:

Name | Type | Description
--- | --- | ---
`redirectURL` | string | where is the callback mounted.
`state` | string | state opaque token to avoid forged requests

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 89

##### Returns:

the redirect URL

Type
  string

#### handle(arg0)

##### Parameters:

Name | Type | Description
--- | --- | ---
`arg0` | RoutingContext |

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 44

#### setupCallback(route) → {OAuth2AuthHandler}

add the callback handler to a given route.

##### Parameters:

Name | Type | Description
--- | --- | ---
`route` | Route | a given route e.g.: `/callback`

Source:
  - vertx-web-js/o_auth2_auth_handler.js, line 103

##### Returns:

self

Type
  OAuth2AuthHandler