Skip to content

Instantly share code, notes, and snippets.

@zoltanarvai
Last active March 23, 2019 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoltanarvai/727f540f1b6a3ded8d01e8beb08d10c7 to your computer and use it in GitHub Desktop.
Save zoltanarvai/727f540f1b6a3ded8d01e8beb08d10c7 to your computer and use it in GitHub Desktop.
defmodule Auth.Guardian do
@moduledoc """
This is the main Guardian module used by the application to gain access to claims,
identity, token, etc.
Implements callback to properly integrate with Auth0.
"""
use Guardian, otp_app: :orders
alias Auth.Identity
@impl Guardian
@doc false
def resource_from_claims(%{"sub" => "auth0|" <> id} = claims), do: {:ok, %Identity{id: id}}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment