I am planing a project with cloud function my functions should connect a 3d party api using authentication header ...etc
this 3dapi requests to refresh the access every hour so i think about creating a cloud task in separate project that will keep the token. and in my functions i will be able to get it somehow
my question is how can i do that
so i would like a 2 projects : 1 for keeping access tokens on firestore or on somewhere else 2- the functions app will be retrieve them when it want in order to make it secured
so where do I keep it and how can i retrieve those token ? firestore ? some other service on cloud? maybe in the same firestore that the funcstions uses?
update: the way i think is
1 - create a bucket
2- create 2 projects. - 1 for token generations , 2 fo the functions iteself
3- token generation will keep the token in bucket storage evrey 10 mintues
4- the function service will get the token from bucket evrey time
thanks
As mentioned in the answer 3rd party APIs can be stored in the firebase by following 3 ways:
- If you truly want to use firebase functions to access your keys, then yes this can be done through firebase's On call Function.
This sends a request to a function with that user's current auth state. You could then verify that the user is real and return the keys.More information on the protocol for sending this requests You can learn more about cloud firestore REST API as:
- Accessing Cloud Firestore from a resource-constrained environment, such as an internet of things (IoT) device, where running a complete client library is impossible.
- Automating database administration or retrieving detailed database metadata. Here a documentation on how to use and manage API for the firebase projects.