Geek Guy
Geek Guy

Reputation: 702

How to create service account for firebase to use with firebase functions

Am building a server with firebase cloud functions and I need other servers to call my server endpoints. The most important thing is that I need these third party domains calling my server to be authenticated.

Question 1: How can I create such a service account, include the service account credentials in the call and extract idTokenfrom it.

Question 2: Is there a tool I can use to test this during development once I know how to make such secure calls, for example, how to do this using Postman REST application or any other preferred tool. Thanks in advance.

Upvotes: 3

Views: 8886

Answers (1)

Scott Kronheim
Scott Kronheim

Reputation: 772

I have some thoughts for #1, at least. Check out the documentation at https://firebase.google.com/docs/auth/admin/verify-id-tokens.

Whoever is calling your service needs to be logged in to Firebase so that it can send an ID token (see the section titled "Retrieve ID tokens on clients"), and your service will need to then verify the token (see the section titled "Verify ID tokens using the Firebase Admin SDK").

I have never tried to emulate the client side of this type of interaction through Postman or anything similar, unfortunately I cannot help with that part of your question.

Upvotes: 1

Related Questions