firebase/snippets-node

What if token has expired when delete collection?

takehilo opened this issue · 2 comments

This question is about the deleting collections and subcollections solution (Doc).

As the document describes, our function should get token from environment variables and pass it to the delete function, but the token would expire and the request would fail.
Any advice on how to keep the token valid?

Thank you.

@takehilo good question! The tokens produced by firebase login:ci are refresh tokens so they live forever unless you explicitly revoke them. So you can store them in your environment one time and then expect them to keep working with no effort.

My mistake was to use access_token generated by login instead of token generated by login:ci.
Thank you for your quick reply!