0
votes

I am creating a RESTful API using the firebase admin SDK, entirely in Golang.
The problem occurs when attempting to integrate token-based authentication, which requires both client SDK and admin SDK

For example,

  1. firebase client SDK provides methods such as signInWithCustomToken and signInWithEmailAndPassword which outputs ID tokens to be handled with methods in Admin SDK.

  2. firebase admin SDK provides methods such as VerifyIDToken to verify token passed from the client.

In the latest firebase documentation, it says,

The Firebase Admin SDKs bundle the Google Cloud client libraries for Cloud Firestore alongside client libraries and SDKs for several other Firebase features.



Since I needed to use both Client and Admin SDK with Golang, I have decided to use the Admin SDK.
However, Admin SDK documentation in Golang does not have methods such as signInWithCustomToken and signInWithEmailAndPassword.

If I were to build a RESTful API with Golang, do I have to use another front-end programming languages like JavaScript to achieve token-based authentication?
In JavaScript Admin SDK, they DO have methods available such as signInWithCustomToken and signInWithEmailAndPassword.

I would like to know the workaround to write token-based authentication when necessary methods are not documented with Golang in Admin SDK.


1
On Stack Overflow, limit yourself to one question per post. I suggest removing the second question, since its not likely that the reader will have an understand about why the FCM APIs were designed the way they are. If you have feedback about Firebase products, contact Firebase support directly. support.google.com/firebase/contact/supportDoug Stevenson

1 Answers

1
votes

The Admin SDK is provides functionality for use with backend code. With Firebase Auth, users are intended to sign in on the frontend and pass an ID token to the backend. If you are suggesting that you would like to use golang to write a frontend-like app, you won't find any APIs for that. You can call the Firebase Auth REST APIs directly in that case.