Skip to content
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

Rework login-flow to retrieve user object from appinfo #9499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bijij
Copy link
Contributor

@bijij bijij commented Jul 16, 2023

Summary

This PR reworks login flow to use the new bot key in the application payload for the ClientUser object, rather than making a 2nd HTTP request.

Note: in its current form, the user object provided by discord by this endpoint lacks information previously used in the ClientUser object, this PR should only be accepted if discord commits to adding the missing information.

Information currently lacking:

  • locale
  • mfa_enabled
  • verified

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@@ -610,8 +610,8 @@ async def login(self, token: str) -> None:
token = token.strip()

data = await self.http.static_login(token)
self._connection.user = ClientUser(state=self._connection, data=data)
self._application = await self.application_info()
self._connection.user = ClientUser(state=self._connection, data=data['bot']) # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it would be better to raise above here if 'bot' not in data.
I don't think it can ever happen though.

@bijij
Copy link
Contributor Author

bijij commented Jul 16, 2023

Do we want add support for the new PATCH endpoint for applications?

@Rapptz
Copy link
Owner

Rapptz commented Jul 18, 2023

Sure.

@bijij
Copy link
Contributor Author

bijij commented Sep 28, 2023

Seems the branch in the API docs has been merged.
Without any response regarding our query.

Given last week I checked and it didn't have the fields, I'm guessing that it's not happening.

@Rapptz
Copy link
Owner

Rapptz commented Sep 28, 2023

Yeah, they basically said to make an issue if we want it but my experience with that means that it's never happening.

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