DEV Community

Discussion on: GCP Api Gateway: Firebase Authentication

Collapse
 
rhernand3z profile image
Rafael H

Great article @amammay ,

I am trying to accomplish something similar but with an API key approach. I followed similar steps and changed the openapi yml to use API key as the security definition. Unfortunately, I keep getting 403 errors even after I created an API key with no restrictions. Would you have some tips when integrating API Gateway with API keys on Cloud Run? Appreciate your help

Collapse
 
amammay profile image
Alex Mammay

Yea sure thing! ill dig into it, and write up a post about it 😀

Collapse
 
amammay profile image
Alex Mammay

@rhernand3z after doing a bit of digging the main thing i could see you having problems with api key auth is to make sure you have this in your security definition

securityDefinitions:
  # This section configures basic authentication with an API key.
  api_key:
    type: "apiKey"
    name: "key"
    in: "query"
Enter fullscreen mode Exit fullscreen mode

and in addition to create the api key entry for

API_ID specifies the name of your API.
PROJECT_ID specifies the name of your Google Cloud project.

gcloud services enable API_ID.apigateway.PROJECT_ID.cloud.goog

i believe you still need to run that command even if your api key is set to unrestricted to create the entry in GCP behind the scenes.

Thread Thread
 
rhernand3z profile image
Rafael H

Hey Alex,

I'll give this a shot, I didn't execute the last step via gcloud services enable..., might have been the culprit. Thanks for digging into this 👍

Thread Thread
 
rhernand3z profile image
Rafael H

Hey @amammay -- I was able to get it working properly. You were right the culprit was not executing:

gcloud services enable ...

Thanks for your help and a great article!