From 3449faf7504471d7d857f627b77cc8cf81d3e026 Mon Sep 17 00:00:00 2001 From: Fleapse <51268198+Fleapse@users.noreply.github.com> Date: Mon, 24 Jun 2024 15:37:45 +0300 Subject: [PATCH] fix(telegram): ensure username is string even if based on id Make username always a string to avoid errors in the user pipeline. Fix https://github.com/python-social-auth/social-core/issues/918 (#921) Co-authored-by: Nikita Pozdnyakov --- social_core/backends/telegram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/social_core/backends/telegram.py b/social_core/backends/telegram.py index b82aa2d1..9e9e1494 100644 --- a/social_core/backends/telegram.py +++ b/social_core/backends/telegram.py @@ -43,7 +43,7 @@ def get_user_details(self, response): last_name = response.get("last_name", "") fullname = f"{first_name} {last_name}".strip() return { - "username": response.get("username") or response[self.ID_KEY], + "username": response.get("username") or str(response[self.ID_KEY]), "first_name": first_name, "last_name": last_name, "fullname": fullname,