Package blue.starry.penicillin.endpoints.oauth2

Functions

Link copied to clipboard
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.

Properties

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

Shorthand property to OAuth2.bearerToken.