-
-
Notifications
You must be signed in to change notification settings - Fork 378
fix(auth): return auth_response from exchange_code_for_session instead of response dict #1288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Previous implementation for reference, xform=parse_auth_response causes response to be a pydantic model, new code seemed to rely on manually parsing the model, but then returns the wrong one of the two objects. async def exchange_code_for_session(self, params: CodeExchangeParams):
code_verifier = params.get("code_verifier") or await self._storage.get_item(
f"{self._storage_key}-code-verifier"
)
response = await self._request(
"POST",
"token",
query={"grant_type": "pkce"},
body={
"auth_code": params.get("auth_code"),
"code_verifier": code_verifier,
},
redirect_to=params.get("redirect_to"),
xform=parse_auth_response,
)
await self._storage.remove_item(f"{self._storage_key}-code-verifier")
if response.session:
await self._save_session(response.session)
self._notify_all_subscribers("SIGNED_IN", response.session)
return response
|
Pull Request Test Coverage Report for Build 18973010848Details
💛 - Coveralls |
Yes, this was a mistake where the variable was only renamed in some places and not others. It wasn't caught because the function does not declare a return type, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've included both the missing return type annotations, with also some additional ruff reformatting from the last PR.
|
Fixed in v2.23.0. |
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Method started returning dict instead of pydantic object
What is the new behavior?
Return the pydantic object
Additional context
There seems have been a behavior change introduced recently, not sure this was intentional, this method used to return the pydantic model, but here it is returning the json. This is breaking our code after updating. Looks like other methods are still returning the pydantic model, so I think this was a mistake.