Skip to content

Commit

Permalink
pipeline: make sure uid is string
Browse files Browse the repository at this point in the history
It is stored as string in the database, so make conversion early.

Fixes python-social-auth/social-app-django#568
  • Loading branch information
nijel committed Apr 25, 2024
1 parent 146a634 commit 70aad43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion social_core/pipeline/social_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def social_details(backend, details, response, *args, **kwargs):


def social_uid(backend, details, response, *args, **kwargs):
return {"uid": backend.get_user_id(details, response)}
return {"uid": str(backend.get_user_id(details, response))}


def auth_allowed(backend, details, response, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions social_core/tests/backends/test_bitbucket_datacenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_login(self):
self.assertEqual(len(user.social), 1)

social = user.social[0]
self.assertEqual(social.uid, 1)
self.assertEqual(social.uid, "1")
self.assertEqual(social.extra_data["first_name"], "Erlich")
self.assertEqual(social.extra_data["last_name"], "Bachman")
self.assertEqual(social.extra_data["email"], "erlich@bachmanity.com")
Expand All @@ -109,7 +109,7 @@ def test_login(self):
def test_refresh_token(self):
_, social = self.do_refresh_token()

self.assertEqual(social.uid, 1)
self.assertEqual(social.uid, "1")
self.assertEqual(social.extra_data["first_name"], "Erlich")
self.assertEqual(social.extra_data["last_name"], "Bachman")
self.assertEqual(social.extra_data["email"], "erlich@bachmanity.com")
Expand Down

0 comments on commit 70aad43

Please sign in to comment.