Home > Mobile >  Firebase auth auth/invalid-action-code when using a code twice
Firebase auth auth/invalid-action-code when using a code twice

Time:12-09

I am trying to log in users via an email link.

The second time the user uses the link I get this error:

auth/invalid-action-code: Thrown if the action code is invalid. This can happen if the code is malformed, expired or has already been used.

I know the code is not malformed because it works on the first time. So the code might be expired or already in use. But, I don't want the codes to ever expire or have a maximum number of uses (the user should be able to use it as many times as he wants).

What can I do?

CodePudding user response:

A sign-in link can be used only once. You'll have to implement your own system if you want permanent tokens e.g. storing the token in a database like Firestore, using a Cloud Function to verify the user with your logic, and signing in the user with custom tokens. However, I won't recommend using the same token multiple times.

  • Related