| [ Web Proxy ] |
| Viewing: https://wiki.python.org/moin/../python/platforms/../../python/../psf/../contributing/api.html | [Back] [Original] |
The OAuth proxy lives in oauth/app.py and handles the GitHub OAuth handshake for Sveltia CMS. Three routes, one module, no database.
When running locally (make oauth-serve), Litestar auto-generates interactive API docs at http://localhost:8000/api via the Scalar UI plugin. In production, the same docs are at api.wiki.python.org/api.
Method |
Path |
What it does |
|---|---|---|
|
|
Redirects the user to GitHubs OAuth authorize page |
|
|
Exchanges the authorization code for a token, posts it back to the CMS via |
|
|
Returns |
GitHub OAuth proxy for Decap CMS.
Redirect the user to GitHubs OAuth authorization page.
Decap CMS hits this endpoint to start the OAuth flow. The user gets
sent to GitHub to approve access, then GitHub redirects back to
callback() with an authorization code.
A random state is generated, stored in a short-lived http-only cookie, and
sent to GitHub; callback() verifies the echoed state against the cookie
to defend against OAuth CSRF / code injection. The requested scope is fixed
server-side (OAUTH_SCOPE) and cannot be influenced by the caller.
provider OAuth provider name (passed by Decap CMS, always github).
site_id Site identifier (passed by Decap CMS, unused).
Exchange a GitHub authorization code for an access token.
GitHub redirects here after the user approves the OAuth request. The proxy
first verifies the state echoed by GitHub against the cookie set in
auth() (CSRF protection), then exchanges the temporary code for an
access token and returns a small HTML page that postMessages the token
back to the CMS window only to an allowlisted origin.
The parameters are deliberately not named state/scope: those are
Litestar reserved keywords and would be injected with framework objects
instead of the request values.
code The authorization code from GitHubs OAuth redirect.
state_param The state value echoed back by GitHub (state query key).
state_cookie The state value stored by auth() (cookie).
Health check endpoint for load balancers and uptime monitors.
Returns {"status": "ok"} when the service is running.
2026, Python Software Foundation
Made with Sphinx and Shibuya theme.
| Web Proxy Viewer | New URL | Original Page |