I realize you can create a firebase token by using
firebase login:ci
You can revoke an individual token by doing
firebase logout --token <token>
But how do you either a) revoke all of them, or b) list all the active tokens?
I want to make sure there aren't leftover tokens that are still active on a project.
Token can be found in firebaseLocalStorageDB.
Because Firebase ID tokens are stateless JWTs, you can determine a token has been revoked only by requesting the token's status from the Firebase Authentication backend. For this reason, performing this check on your server is an expensive operation, requiring an extra network round trip.
You must set the header Content-Type: application/json or you will get errors (e.g. "MISSING_GRANT_TYPE"). Show activity on this post. Trade the refresh-token for an access-token (using google's public api) Trade the access-token for a custom-token (using a firebase-function, see below)
These tokens are Google OAuth2 refresh tokens (see bullet 4 in Google Identity Platform). Their number is limited (i guess it is 25 ).
The easiest way to explicitly revoke a token is to use firebase logout --token <token>
as you mentioned. I do not know of an API for listing outstanding refresh tokens, I'm not sure it exists.
But I do know that clicking 'Remove' on the Firebase CLI entry here: https://myaccount.google.com/permissions will revoke the active tokens.
Logging back in will prompt you for permissions again and if you grant them your new token will be the only valid one.
So, It's better to remove permission from your App permissions, so no leftover tokens are there on your project.
You should test this before I'd be certain it works, but you can likely go to Apps connected to your account for your Google account and revoke access to the Firebase CLI app. This should immediately revoke any outstanding tokens, and you can then run firebase login
again to re-authenticate yourself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With