I have a firebase authentication token that i am trying to pass to a web api controller. I am following this post here. stackoverflowpost
I have the bearer token in the $http request headers.
I took care of cors(unless I missed something). The end point in my api project is receiving the request with null headers. So I am trying to debug what is wrong but without any specific errors I am not sure where to look
To do so securely, after a successful sign-in, send the user's ID token to your server using HTTPS. Then, on the server, verify the integrity and authenticity of the ID token and retrieve the uid from it. You can use the uid transmitted in this way to securely identify the currently signed-in user on your server.
Generate an access token The Realtime Database REST API accepts standard Google OAuth2 access tokens. The access tokens can be generated using a service account with proper permissions to your Realtime Database.
Every time a user signs in, the user credentials are sent to the Firebase Authentication backend and exchanged for a Firebase ID token (a JWT) and refresh token. Firebase ID tokens are short lived and last for an hour; the refresh token can be used to retrieve new ID tokens.
You can get the value of an element "Authorization" in header by using following code:
string firebaseAuthToken = string.Empty;
firebaseAuthToken = actionContext.Request.Headers.GetValues("Authorization").First();
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