Package blue.starry.penicillin.endpoints.oauth

Types

Link copied to clipboard
data class AccessTokenResponse(    val accessToken: String,     val accessTokenSecret: String,     val userId: Long,     val screenName: String)

Represents "/oauth/access_token" response.

Link copied to clipboard
data class RequestTokenResponse(    val requestToken: String,     val requestTokenSecret: String,     val callbackConfirmed: Boolean)

Represents "/oauth/request_token" response.

Functions

Link copied to clipboard
suspend fun OAuth.accessToken(    requestToken: String,     requestTokenSecret: String,     verifier: String,     vararg options: Option): AccessTokenResponse
suspend fun OAuth.accessToken(    consumerKey: String,     consumerSecret: String,     requestToken: String,     requestTokenSecret: String,     verifier: String,     vararg options: Option): AccessTokenResponse

Allows a Consumer application to exchange the OAuth Request Token for an OAuth Access Token. This method fulfills Section 6.3 of the OAuth 1.0 authentication flow.

Link copied to clipboard
fun OAuth.authenticateUrl(    requestToken: String,     forceLogin: Boolean? = null,     screenName: String? = null,     vararg options: Option): Url

Allows a Consumer application to use an OAuth request_token to request user authorization. This method is a replacement of Section 6.2 of the OAuth 1.0 authentication flow for applications using the callback authentication flow. The method will use the currently logged in user as the account for access authorization unless the force_login parameter is set to true. This method differs from GET oauth/authorize in that if the user has already granted the application permission, the redirect will occur without the user having to re-approve the application. To realize this behavior, you must enable the Use Sign in with Twitter setting on your application record.

Link copied to clipboard
fun OAuth.authorizeUrl(    requestToken: String,     forceLogin: Boolean? = null,     screenName: String? = null,     vararg options: Option): Url

Allows a Consumer application to use an OAuth Request Token to request user authorization. This method fulfills Section 6.2 of the OAuth 1.0 authentication flow. Desktop applications must use this method (and cannot use GET oauth/authenticate. Usage Note: An oauth_callback is never sent to this method, provide it to POST oauth/request_token instead.

Link copied to clipboard
fun OAuth.invalidateToken(vararg options: Option): JsonObjectApiAction<OAuthToken>
fun OAuth.invalidateToken(    accessToken: String,     accessTokenSecret: String,     vararg options: Option): JsonObjectApiAction<OAuthToken>

Allows a registered application to revoke an issued OAuth access_token by presenting its client credentials. Once an access_token has been invalidated, new creation attempts will yield a different Access Token and usage of the invalidated token will no longer be allowed.

Link copied to clipboard
suspend fun OAuth.requestToken(    callbackUrl: String = "oob",     xAuthAccessType: String? = null,     vararg options: Option): RequestTokenResponse

Allows a Consumer application to obtain an OAuth Request Token to request user authorization. This method fulfills Section 6.1 of the OAuth 1.0 authentication flow. We require you use HTTPS for all OAuth authorization steps. Usage Note: Only ASCII values are accepted for the oauth_nonce

Properties

Link copied to clipboard
val OAuth.invalidateToken: JsonObjectApiAction<OAuthToken>

Shorthand property to OAuth.invalidateToken.