Skip to content

Add Support for Device Code Authorization - #574

Open
antheng wants to merge 17 commits into
requests:masterfrom
antheng:device-code-token
Open

antheng wants to merge 17 commits into
requests:masterfrom
antheng:device-code-token

Conversation

@antheng

@antheng antheng commented Sep 2, 2026 •

Copy link
Copy Markdown

Adds support for OAuth2.0 device code authorization flow as per RFC 8628 by adding the async function Oauth2Session.token_from_device_code. For a given device authorization endpoint, this function can be called with options for explicit interval polling time.

Process:

  1. Retrieve the initial device code response
  2. Print returned verification_uri and user_code to stdout
  3. If device code expires raise a TimeoutError

Also makes changes to tests in Oauth2SessionTest: set self.token_endpoint = "https://example.com/token" as it was often repeated between tests.

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.

1 participant