Hi everyone,
I use Firebase authentication for my React Native App. Once users are registered an logged-in, they can send a request to a Google function:
- the App sets the Authorization bearer in request header with JWT token
- the Function checks the JWT validity with firebase_admin auth.verify_id_token() function
If my function HTTPS trigger is set on :
-> Allow unauthenticated invocations : everything works fine the token is validated, I can proceed with execution
-> Require authentication : I get a 401 error before accessing to my function even though the Authorization header is present in the request.
Logs in Function says : The request was not authorized to invoke this service. Read more at https://cloud.google.com/run/docs/securing/authenticating Additional troubleshooting documentation can be found at: https://cloud.google.com/run/docs/troubleshooting#401
I went on these docs but couln't find anything relevant, or that I could understand/apply to my issue.
Am I missing a configuration or a comprehension of 'Require Authentication', I thought it would check the JWT before my function executes so I wouldn't have to do it in the function.
Thanks and have a lovely day,
Hi @Xolkys,
Welcome to Google Cloud Community!
To authenticate Firebase users on Google Functions, you need to:
Reference that might be helpful: