Here’s a step-by-step guide:
​
PKCE Guide
​
Step 1: Send your user to OpenRouter
To start the PKCE flow, send your user to OpenRouter’s
/auth
URL with a
callback_url
parameter pointing back to your site:
With S256 Code Challenge (Recommended)
With Plain Code Challenge
Without Code Challenge
https://openrouter.ai/auth?callback_url=<YOUR_SITE_URL>&code_challenge=<CODE_CHALLENGE>&code_challenge_method=S256
https://openrouter.ai/auth?callback_url=<YOUR_SITE_URL>&code_challenge=<CODE_CHALLENGE>&code_challenge_method=plain
https://openrouter.ai/auth?callback_url=<YOUR_SITE_URL>
The
code_challenge
parameter is optional but recommended.
Your user will be prompted to log in to OpenRouter and authorize your app.
