View Source Zoth (Zoth v1.0.1)

A module that provides OAuth 2 capabilities for Elixir applications.

configuration

Configuration

config :my_app, Zoth,
  repo: App.Repo,
  resource_owner: App.Users.User,
  default_scopes: ~w(public),
  optional_scopes: ~w(write update),
  native_redirect_uri: "urn:ietf:wg:oauth:2.0:oob",
  authorization_code_expires_in: 600,
  access_token_expires_in: 7200,
  use_refresh_token: false,
  revoke_refresh_token_on_use: false,
  force_ssl_in_redirect_uri: true,
  grant_flows: ~w(authorization_code client_credentials),
  password_auth: nil,
  access_token_response_body_handler: nil

If revoke_refresh_token_on_use is set to true, refresh tokens will be revoked after a related access token is used.

If revoke_refresh_token_on_use is not set to true, previous tokens are revoked as soon as a new access token is created.

If use_refresh_token is set to true, the refresh_token grant flow is automatically enabled.

If password_auth is set to a {module, method} tuple, the password grant flow is automatically enabled.

If access_token_expires_in is set to nil, access tokens will never expire.

Link to this section Summary

Link to this section Functions

Link to this function

authenticate_token(token, config \\ [])

View Source

Authenticate an access token.

example

Example

Zoth.authenticate_token("Jf5rM8hQBc", otp_app: :my_app)

response

Response

{:ok, access_token}
{:error, reason}
Link to this function

end_session(request_params, config)

View Source

TODO

Link to this function

get_openid_config(config)

View Source

See Zoth.OpenId.get_config/1.

Link to this function

get_openid_public_signing_key(config)

View Source

See Zoth.OpenId.get_public_key/1.

Link to this function

list_openid_claims(config)

View Source

See Zoth.OpenId.list_claims/1.