Assent.Strategy.Discord (Assent v0.4.0)

Copy Markdown View Source

Discord OAuth 2.0 strategy.

Usage

config = [
  client_id: "REPLACE_WITH_CLIENT_ID",
  client_secret: "REPLACE_WITH_CLIENT_SECRET",
  redirect_uri: "http://localhost:4000/auth/callback"
]

See Assent.Strategy.OAuth2 for more.

Summary

Functions

Generates an OAuth 2.0 authorization URL.

Handles an OAuth 2.0 callback.

Fetches user data using the access token returned by the provider.

Functions

authorize_url(config)

Generates an OAuth 2.0 authorization URL.

callback(config, params)

Handles an OAuth 2.0 callback.

fetch_user(config, token)

@spec fetch_user(Keyword.t(), map()) :: {:ok, map()} | {:error, term()}

Fetches user data using the access token returned by the provider.