7ahid
7ahid

Reputation: 520

Single-use Firebase token

Is it possible to generate a one-time use token through Firebase Auth?

I want to:

  1. Send a user an email containing a link, this link with contain the token
  2. User fills out a form and presses submit
  3. Token is sent back to the API along with the form data (token will probably be Auth header)
  4. firebase.auth().verifyIdToken() from firebase-admin is used to decode the token and check for a custom claim
  5. Once verified, the token is nullified so it cannot be used again

Trying to do this without rolling my own solution. My API is built using Node.js and it would be really nice if the same middleware that handles Firebase Auth can be used on this particular endpoint too.

Upvotes: 1

Views: 424

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598817

There is nothing built into Firebase Authentication that you can use for this. You could use the same approach Firebase uses for signing its tokens (JWT) to build it, but that would be rolling your own solution.

Upvotes: 1

Related Questions