OAuth2

class OAuth2(val client: ApiClient) : Endpoint

Collection of api endpoints related to OAuth 2 Authentication.

See also

Parameters

client

Current ApiClient instance.

Constructors

Link copied to clipboard
fun OAuth2(client: ApiClient)

Creates new OAuth2 endpoint instance.

Properties

Link copied to clipboard
open override val client: ApiClient

Extensions

Link copied to clipboard
val OAuth2.bearerToken: JsonObjectApiAction<OAuthToken>

Shorthand property to OAuth2.bearerToken.

fun OAuth2.bearerToken(grantType: String = "client_credentials", vararg options: Option): JsonObjectApiAction<OAuthToken>

Allows a registered application to obtain an OAuth 2 Bearer Token, which can be used to make API requests on an application's own behalf, without a user context. This is called Application-only authentication. A Bearer Token may be invalidated using oauth2/invalidate_token. Once a Bearer Token has been invalidated, new creation attempts will yield a different Bearer Token and usage of the previous token will no longer be allowed. Only one bearer token may exist outstanding for an application, and repeated requests to this method will yield the same already-existent token until it has been invalidated. Successful responses include a JSON-structure describing the awarded Bearer Token. Tokens received by this method should be cached. If attempted too frequently, requests will be rejected with a HTTP 403 with code 99.

Link copied to clipboard
fun OAuth2.invalidateToken(bearerToken: String, vararg options: Option): JsonObjectApiAction<OAuthToken>

Allows a registered application to revoke an issued OAuth 2 Bearer Token by presenting its client credentials. Once a Bearer Token has been invalidated, new creation attempts will yield a different Bearer Token and usage of the invalidated token will no longer be allowed. Successful responses include a JSON-structure describing the revoked Bearer Token.