Lightning.AuthProviders.OAuthBehaviour behaviour (Lightning v2.13.5)

View Source

Defines a behaviour for OAuth providers within the Lightning application, specifying a common interface for OAuth operations. This interface ensures consistency and interoperability among different authentication providers (e.g., Google, Salesforce) by defining a set of required functions that each provider must implement.

Summary

Callbacks

authorize_url(client, state, scopes, opts)

@callback authorize_url(
  client :: map(),
  state :: String.t(),
  scopes :: [String.t()],
  opts :: Keyword.t()
) :: String.t()

build_client(opts)

@callback build_client(opts :: Keyword.t()) :: {:ok, map()} | {:error, :invalid_config}

get_token(client, wellknown_url, params)

@callback get_token(
  client :: map(),
  wellknown_url :: String.t() | nil,
  params :: map()
) :: {:ok, map()} | {:error, map()}

get_userinfo(client, token, wellknown_url)

@callback get_userinfo(
  client :: map(),
  token :: map(),
  wellknown_url :: String.t()
) :: {:ok, map()} | {:error, map()}

refresh_token(token, wellknown_url)

@callback refresh_token(
  token :: map(),
  wellknown_url :: String.t() | nil
) :: {:ok, map()} | {:error, map()}

refresh_token(client, token, wellknown_url)

@callback refresh_token(
  client :: map(),
  token :: map(),
  wellknown_url :: String.t() | nil
) :: {:ok, map()} | {:error, map()}