Closed Fleapse closed 5 months ago
the user should not receive errors
the user receive errors: 'int' object is not subscriptable in social_core/pipeline/user.py in get_username at line 46
'int' object is not subscriptable in social_core/pipeline/user.py in get_username at line 46
if the user does not have a username in telegram, then he cannot log in
this happens because in social_core.backends.telegram.TelegramAuth if the user does not have a username, it is replaced with an id with the int type
For myself I'm going to fix it like this:
class CustomTelegramAuth(TelegramAuth): def get_user_details(self, response): first_name = response.get("first_name", "") last_name = response.get("last_name", "") fullname = f"{first_name} {last_name}".strip() return { "username": response.get("username") or str(response[self.ID_KEY]), "first_name": first_name, "last_name": last_name, "fullname": fullname, }
old "username": response.get("username") or response[self.ID_KEY], new "username": response.get("username") or str(response[self.ID_KEY]),
It seems that the same thing can be done here, so that others do not experience similar problems
Can you please create a pull request with the change?
https://github.com/python-social-auth/social-core/pull/921 here it is
Expected behaviour
the user should not receive errors
Actual behaviour
the user receive errors: 'int' object is not subscriptable in social_core/pipeline/user.py in get_username at line 46
Any logs, error output, etc?
'int' object is not subscriptable in social_core/pipeline/user.py in get_username at line 46
Any other comments?
if the user does not have a username in telegram, then he cannot log in
this happens because in social_core.backends.telegram.TelegramAuth if the user does not have a username, it is replaced with an id with the int type
For myself I'm going to fix it like this:
It seems that the same thing can be done here, so that others do not experience similar problems