View Source FirebaseJwt (Firebase JWT Veirifer v0.2.0)

example

Example

with-valid-token

With valid token

iex> FirebaseJwt.verify(json_web_token_string)

{:ok,
 %{
   "aud" => "your-project",
   "auth_time" => 1553858461,
   "email" => "you@example.com",
   "email_verified" => true,
   "exp" => 1553862061,
   "firebase" => %{
     "identities" => %{
       "email" => ["you@example.com"],
       "google.com" => ["1234567890"]
     },
     "sign_in_provider" => "google.com"
   },
   "iat" => 1553858461,
   "iss" => "https://securetoken.google.com/your-project",
   "name" => "Your Name",
   "picture" => "https://example.com/you.jpg",
   "sub" => "fedcba0987654321",
   "user_id" => "1234567890abcdef"
 }}

with-invalid-token

With invalid token

iex> FirebaseJwt.verify(json_web_token_string)

{:error, nil}

Link to this section Summary

Functions

Verify token

Verify token and return payload only when it's valid

Link to this section Functions

Verify token

Verify token and return payload only when it's valid