WardrikOAuth.Browser (wardrik_oauth v0.1.0-rc.1)

Copy Markdown

Browser sign-in: the authorization code flow with PKCE, on the service's own page.

Summary

Functions

Exchanges the code a principal came back with for a token.

Returns whether a callback's iss matches the issuer, or may be absent.

Builds the URL that starts a sign-in, with its state and PKCE verifier.

Functions

exchange(metadata, provider, code, verifier, opts)

@spec exchange(
  WardrikOAuth.Metadata.t(),
  WardrikOAuth.Provider.t(),
  String.t(),
  String.t(),
  keyword()
) ::
  {:ok, WardrikOAuth.Token.t()} | {:error, term()}

Exchanges the code a principal came back with for a token.

issued_by?(metadata, issuer)

@spec issued_by?(WardrikOAuth.Metadata.t(), String.t() | nil) :: boolean()

Returns whether a callback's iss matches the issuer, or may be absent.

start(metadata, provider, redirect_uri)

@spec start(WardrikOAuth.Metadata.t(), WardrikOAuth.Provider.t(), String.t()) ::
  {:ok, %{url: String.t(), state: String.t(), verifier: String.t()}}
  | {:error, term()}

Builds the URL that starts a sign-in, with its state and PKCE verifier.