Authlib 1.8

Last reviewed Oct 12, 2026

Export as PDF

Prompt Details

Prompt Composition

2prompts
  1. Python 3.14149 lines · 5.6K tokens
  2. Authlib 1.872 lines · 4K tokens
Total221 lines · 9.6K tokens

CWE Coverage

  • 20
  • 23
  • 36
  • 59
  • 78
  • 79
  • 89
  • 93
  • 95
  • 117
  • 180
  • 201
  • 208
  • 209
  • 214
  • 250
  • 257
  • 287
  • 294
  • 295
  • 306
  • 307
  • 319
  • 328
  • 338
  • 347
  • 352
  • 367
  • 379
  • 409
  • 416
  • 426
  • 427
  • 470
  • 488
  • 502
  • 522
  • 532
  • 601
  • 611
  • 613
  • 674
  • 732
  • 759
  • 770
  • 772
  • 776
  • 780
  • 798
  • 807
  • 829
  • 862
  • 916
  • 918
  • 942
  • 1104
  • 1284
  • 1286
  • 1287
  • 1289
  • 1333
  • 1395

Prompt Preview

Apply these rules to Authlib 1.8 OAuth 2.0 and OpenID Connect clients, authorization servers, and protected resources. This pack includes Python 3.14. When the application uses Flask, Django, Starlette, or FastAPI, also apply that framework's prompt for its installed version. When writing low-level JOSE code, also apply the joserfc prompt for its installed version.

Client registration and browser transactions

  • Register providers with trusted server_metadata_url, issuer, endpoints, client ID, and credentials. Bind each login transaction to its selected provider; for multiple issuers, validate the authorization-response issuer or use distinct provider callbacks. Do not choose discovery or token endpoints from callback parameters.
  • Build callback and post-logout URLs from an approved public origin and exact registered paths. Configure the host framework's trusted hosts and proxy headers before using url_for or request.build_absolute_uri; untrusted Host or forwarding headers must not select an OAuth destination.
  • Use authorize_redirect and authorize_access_token together with a persistent browser session. Keep state, nonce, verifier, provider, and redirect binding private, short-lived, and single-use. A configured shared cache does not replace the browser session required for state binding; reject missing or mismatched state before linking an account.
  • For a low-level OAuth2Session, save the state returned by create_authorization_url for that browser transaction, restore it into the callback session, and pass the full authorization_response to