I am encountering a 403 Forbidden error when using GeminiApp to make doGet requests to the Google Gemini API. The error message indicates that the Referer header is missing or empty:
Request failed with code 403 - {
"error": {
"code": 403,
"message": "Requests from referer \u003cempty\u003e are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_HTTP_REFERRER_BLOCKED",
"domain": "googleapis.com",
"metadata": {
"consumer": "projects/XXXXXXXXXXXX",
"service": "generativelanguage.googleapis.com",
"httpReferrer": "\u003cempty\u003e"
}
},
{
"@type": "type.googleapis.com/google.rpc.LocalizedMessage",
"locale": "en-US",
"message": "Requests from referer \u003cempty\u003e are blocked."
}
]
}
}
Relevant code might be in _getHeaders(url) {...}
I am using an API key to authenticate and have set website restrictions to the key. Is there a way to send the Referer?
I am encountering a 403 Forbidden error when using GeminiApp to make doGet requests to the Google Gemini API. The error message indicates that the Referer header is missing or empty:
Relevant code might be in
_getHeaders(url) {...}I am using an API key to authenticate and have set website restrictions to the key. Is there a way to send the Referer?