Skip to content

[Authlib] Improve starlette integrations - #16699

Merged
srittau merged 3 commits into
python:mainfrom
Bear-03:authlib-starlette
Nov 5, 2026
Merged

srittau merged 3 commits into
python:mainfrom
Bear-03:authlib-starlette

Conversation

@Bear-03

@Bear-03 Bear-03 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

The starlette_client stubs leave requests, responses and tokens untyped, so authorize_redirect() and authorize_access_token() return Any, unlike the Flask and Django integrations after #16368 and #16382.

This uses the real Starlette types, returns OAuth2Token from StarletteOAuth2App.authorize_access_token(), types the app returned by OAuth.register() from client_cls, and enables stubtest for the module.

Upstream:

Prepared with Hermes Agent (Claude).

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@srittau

srittau commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

We have to add starlette to the stub_uploader allowlist (here).

@Bear-03

Bear-03 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Hi @srittau! I've posted a PR with the fix there. Let me know if anything else is needed.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau merged commit 99df241 into python:main Nov 5, 2026
74 checks passed
@Bear-03
Bear-03 deleted the authlib-starlette branch November 5, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants