Users can connect to Glama Gateway in one click using Proof Key for Code Exchange (PKCE).
Redirect your user to the following URL:
https://glama.ai/oauth/authorize
code_challenge
Include these parameters in the URL:
code_challenge=CODE_CHALLENGE
code_challenge_method=S256
Generate the code_challenge
using S256:
Store the value of codeVerifier
and use it in the Step 2.
Example:
https://glama.ai/oauth/authorize
After the user logs in, they will be redirected back to your site with an authorization code
included in the URL as a query parameter. Use this code
to exchange it for a user-controlled API key.
The API key will be returned in the response under the key apiKey
. Store it securely and use it to authenticate requests against Glama's OpenAI-compatible gateway:
You can use libraries compatible with the OpenAI API, such as openai (for JavaScript) or openai (for Python).
If you have any questions or need help, reach out to our support.