Skip to main content Link Search Menu Expand Document (external link)

index overview

Added in v0.1.0


Table of contents


constructors

exchangeAuthorizationCode

Exchange an authorization code for an access token.

Signature

export declare function exchangeAuthorizationCode<A>(
  decoder: Decoder<JsonRecord, A>
): (code: string) => RTE.ReaderTaskEither<OAuthEnv & FetchEnv, unknown, AccessToken & A>
export declare function exchangeAuthorizationCode(): (
  code: string
) => RTE.ReaderTaskEither<OAuthEnv & FetchEnv, unknown, AccessToken>

Added in v0.1.0

requestAuthorizationCode

Returns a middleware that requests authorization from the user.

Signature

export declare function requestAuthorizationCode(
  scope: string
): (state?: string) => ReaderMiddleware<OAuthEnv, StatusOpen, ResponseEnded, never, void>

Added in v0.1.0

model

AccessToken (interface)

Signature

export interface AccessToken {
  readonly access_token: string
  readonly token_type: string
}

Added in v0.1.0

OAuthEnv (interface)

Signature

export interface OAuthEnv {
  readonly oauth: {
    readonly authorizeUrl: URL
    readonly clientId: string
    readonly clientSecret: string
    readonly redirectUri: URL
    readonly tokenUrl: URL
  }
}

Added in v0.1.0