Skip to content

Why is x-goog-api-key used instead of the Authorization header? #75

Description

@kernusr

client/src/Factory.php

Lines 120 to 122 in 6dca9a5

if ($this->apiKey !== null) {
$this->headers['x-goog-api-key'] = trim($this->apiKey);
}

Why not replace this code with the one below

if ($this->apiKey !== null) {
        $this->headers['Authorization'] = 'Bearer ' . trim($this->apiKey);
}

This approach is described in the documentation from Google https://ai.google.dev/gemini-api/docs/oauth#curl

For example, I use a proxy to access gemini api and it requires authorization only using the Authorization header. And most likely I'm not alone in this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions