Skip to content

Commit

Permalink
Correctly fill user_info for authentication
Browse files Browse the repository at this point in the history
Fedora userinfo doesn't contain mail and github username is in different field.

Signed-off-by: Michal Konecny <[email protected]>
  • Loading branch information
Zlopez committed Dec 5, 2024
1 parent eba218a commit d2e0a29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion anitya/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ def auth(name): # pragma: no cover
token = client.authorize_access_token()
if name == "fedora":
user_info = client.userinfo(token=token)
user_info["email"] = token.get("email")
user_info["username"] = user_info["preferred_username"]
user_info["email"] = user_info["username"] + "@fedoraproject.org"
elif name == "github":
resp = client.get("user", token=token)
user_info = resp.json()
user_info["username"] = user_info["login"]
elif name == "google":
user_info = token.get("userinfo")
user_info["username"] = user_info["email"]
Expand Down

0 comments on commit d2e0a29

Please sign in to comment.