Skip to content

#6 Add OAuth exchange_code (POST /api/token)#12

Open
nstillman-te wants to merge 1 commit intomasterfrom
feature/chess-148-oauth-token-exchange-#6
Open

#6 Add OAuth exchange_code (POST /api/token)#12
nstillman-te wants to merge 1 commit intomasterfrom
feature/chess-148-oauth-token-exchange-#6

Conversation

@nstillman-te
Copy link
Copy Markdown

Part of #6.

Adds client.oauth.exchange_code() to exchange an authorization code for an access token (POST /api/token). Completes the OAuth2 Authorization Code + PKCE flow: call after the user returns from the authorization URL with a code. Response typed as OAuthTokenResponse (token_type, access_token, expires_in). Requests-mock tests verify response shape and form body params.

Checklist when adding a new endpoint
  • Added new endpoint to the README.rst
  • Ensured that my endpoint name does not repeat the name of the client. Wrong: client.users.get_user(), Correct: client.users.get()
  • Typed the returned JSON using TypedDicts in berserk/types/OAuthTokenResponse in berserk/types/oauth.py
  • Written tests (requests-mock for POST form body and response validation; no VCR — endpoint requires valid code)
  • Added the endpoint to CHANGELOG.rst in the To be released section

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