# Class Web.Auth.OAuth2.Base

Inheritance graph

Description

  Generic OAuth2 client class.

Constant STATE

  `protected constant int Web.Auth.OAuth2.Base.STATE`

Description

  Some OAuth2 verifiers need the STATE parameter. If this is not `0` a random string will be generated and the `state` parameter will be added to the request.

Constant USER_AGENT

  `protected constant string Web.Auth.OAuth2.Base.USER_AGENT`

Description

  User agent string.

Constant VERSION

  `protected constant string Web.Auth.OAuth2.Base.VERSION`

Description

  Version of this implementation.

Variable _access_type

  `protected string Web.Auth.OAuth2.Base._access_type`

Description

  Access type of the request.

Variable _client_id

  `protected string Web.Auth.OAuth2.Base._client_id`

Description

  The application ID.

Variable _client_secret

  `protected string Web.Auth.OAuth2.Base._client_secret`

Description

  The application secret.

Variable _grant_type

  `protected string Web.Auth.OAuth2.Base._grant_type`

Description

  - GRANT_TYPE_AUTHORIZATION_CODE for apps running on a web server

  - GRANT_TYPE_IMPLICIT for browser-based or mobile apps

  - GRANT_TYPE_PASSWORD for logging in with a username and password

  - GRANT_TYPE_CLIENT_CREDENTIALS for application access

Variable _redirect_uri

  `protected string Web.Auth.OAuth2.Base._redirect_uri`

Description

  Where the authorization page should redirect to.

Variable _response_type

  `protected string Web.Auth.OAuth2.Base._response_type`

Description

  - RESPONSE_TYPE_CODE for apps running on a webserver

  - RESPONSE_TYPE_TOKEN for apps browser-based or mobile apps

Variable _scope

  `protected string|array(string)|multiset(string) Web.Auth.OAuth2.Base._scope`

Description

  The scope of the authorization. Limits the access.

Variable access_token

  `string Web.Auth.OAuth2.Base.access_token`

Description

  Getting

  Getter for `access_token`.

  Setting

  Getter for `access_token`.

Variable created

  `Calendar.Second Web.Auth.OAuth2.Base.created`

Description

  Getter for when the authentication was `created`.

Note

  Read only

Variable expires

  `Calendar.Second Web.Auth.OAuth2.Base.expires`

Description

  Getter for when the authentication `expires`.

Note

  Read only

Variable http_request_timeout

  `int(1..) Web.Auth.OAuth2.Base.http_request_timeout`

Description

  Request timeout in seconds. Only affects async queries.

Variable refresh_token

  `string Web.Auth.OAuth2.Base.refresh_token`

Description

  Getter for `refresh_token`.

Note

  Read only

Variable request_headers

  `protected mapping Web.Auth.OAuth2.Base.request_headers`

Description

  Default request headers.

Variable token_type

  `string Web.Auth.OAuth2.Base.token_type`

Description

  Getter for `token_type`.

Note

  Read only

Variable user

  `mapping Web.Auth.OAuth2.Base.user`

Description

  Getter for the `user` mapping which may or may not be set.

Note

  Read only

Variable valid_scopes

  `protected multiset(string) Web.Auth.OAuth2.Base.valid_scopes`

Description

  A mapping of valid scopes for the API.

Method create

  `Web.Auth.OAuth2.Base Web.Auth.OAuth2.Base(string client_id, string client_secret, void|string redirect_uri, void|string|array(string)|multiset(string) scope)`

Description

  Creates an OAuth2 object.

Parameter `client_id`

  The application ID.

Parameter `client_secret`

  The application secret.

Parameter `redirect_uri`

  Where the authorization page should redirect back to. This must be a fully qualified domain name. This can be set/overridden in get_auth_uri() and/or set_redirect_uri().

Parameter `scope`

  Extended permissions to use for this authentication. This can be set/overridden in get_auth_uri().