I have hosted a React app in firebase. And created Google Cloud Functions and deployed directly to GCP Cloud Functions.
API Gateway is setup to do APIKey/JWT validations before calling the functions. I added the Cloud Functions Invoker
role to allAuthenticatedUsers
. But when I make request via curl
it fails (401: Unauthorized
) with below message.
Message: Your client does not have permission to the requested URL
I am using the token from user.getIdToken()
and making call with below curl
command
curl --request GET --header "Authorization: Bearer ${TOKEN}" $AUTH_GATEWAY_URL
I get the valid api response, if I add the Cloud Functions Invoker
role to allUsers
.
I referred couple of SO questions below
SO Q1: Issue was using access token, instead of IdToken.
SO Q2: In my case, the JWT issuer is matching.
I am not sure what I am missing. Any suggestions would be greatly appreciated.