Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method for generating custom tokens #34

Open
Nickforall opened this issue Nov 10, 2021 · 0 comments
Open

Add a method for generating custom tokens #34

Nickforall opened this issue Nov 10, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Nickforall
Copy link
Owner

Nickforall commented Nov 10, 2021

https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library

we would need people to supply their key/client email

along the lines of:

    key = JOSE.JWK.from_pem("private key")

    JOSE.JWT.sign(key, %{"alg" => "RS256"}, %{
      iss: "firebase client email",
      sub: "firebase client email",
      aud:
        "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit",
      iat: :os.system_time(:seconds),
      exp: :os.system_time(:seconds) + 3600,
      uid: firebase_user_id
    })
    |> JOSE.JWS.compact()
    |> elem(1)
@Nickforall Nickforall added the enhancement New feature or request label Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant