ExFirebaseAuth.Token (ex_firebase_auth v0.2.0)

Link to this section Summary

Functions

Returns the configured issuer

Verifies a token agains google's public keys. Returns {:ok, userid, claims} if successful. {:error, } otherwise.

Link to this section Functions

Specs

issuer() :: String.t()

Returns the configured issuer

Examples

iex> ExFirebaseAuth.Token.issuer()
"https://securetoken.google.com/project-123abc"
Link to this function

verify_token(token_string)

Specs

verify_token(String.t()) ::
  {:error, String.t()} | {:ok, String.t(), JOSE.JWT.t()}

Verifies a token agains google's public keys. Returns {:ok, userid, claims} if successful. {:error, } otherwise.

Examples

iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
{:ok, "user id", %{}}

iex> ExFirebaseAuth.Token.verify_token("ey.some.token")
{:error, "Invalid JWT header, `kid` missing"}