DEV Community

Discussion on: GCP Api Gateway: Firebase Authentication

Collapse
 
evanegasveredata profile image
Ernesto Vanegas • Edited

Hi Alex @amammay ! Thank you for the article! It's good to see that the google product is starting to get traction because there's still missing some documentation around it. I have a case where I am trying to use two security methods: api-key OR firebase. But whenever I place the firebase authentication, it only works with that one. Any pointers to solve this?


securityDefinitions:
api_key:
type: "apiKey"
name: "x-api-key"
in: "header"
firebase:
authorizationUrl: ""
flow: "implicit"
type: "oauth2"
# Replace YOUR-PROJECT-ID with your project ID
x-google-issuer: "securetoken.google.com/YOUR-PROJEC..."
x-google-jwks_uri: "googleapis.com/service_accounts/v1..."
x-google-audiences: "YOUR-PROJECT-ID"
schemes:

  • https produces:
  • application/json paths: /scoring: post: summary: Score operationId: score-v1 security: - api_key: [] - firebase: [] x-google-backend: address: MYBACKEND responses: '200': description: OK '401': description: Not authorized

If I use firebase it works, but if I use api-key it says:

{
"message": "Jwt is missing",
"code": 401
}

Collapse
 
amammay profile image
Alex Mammay

hmmm that is quite interesting, it seems as your swagger definition looks good. Ill have to give it a try and see if it produces similar results

Collapse
 
evanegasveredata profile image
Ernesto Vanegas

@amammay So... i've tried recreating the gateway, changing different alternatives of security order but nothing. I've created a bug in their issue tracker but I think it will take some time to fix...
issuetracker.google.com/issues/186...