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

Conditionally fetch email #78

Merged
merged 3 commits into from
May 27, 2023
Merged

Conditionally fetch email #78

merged 3 commits into from
May 27, 2023

Conversation

aiwaiwa
Copy link
Contributor

@aiwaiwa aiwaiwa commented May 26, 2023

Not a very sophisticated approach to simply ignore email. But I couldn't discover any immediate punishment and it seems to simply return a valid %Ueberauth.Auth struct with nil for email field along with other nil for a bunch of other data that is beyond the scope.

@aiwaiwa aiwaiwa requested a review from a team as a code owner May 26, 2023 15:04
@aiwaiwa
Copy link
Contributor Author

aiwaiwa commented May 26, 2023

Addresses #77

@@ -175,7 +175,7 @@ defmodule Ueberauth.Strategy.Github do
name: user["name"],
description: user["bio"],
nickname: user["login"],
email: fetch_email!(user, allow_private_emails),
email: maybe_fetch_email(user, allow_private_emails),
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason we couldn't update fetch_email! to avoid raising an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one of two places where fetch_email! used to be used. The other one seems to be a legit place for raising with the expectation of the field existence.

Also, get_primary_email! and get_private_email! do no raise, so I could clean them up to have no ! in the names and call maybe_fetch_email from fetch_email!.

Copy link
Member

@yordis yordis left a comment

Choose a reason for hiding this comment

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

Hey, do you mind adding an entry to https://github.com/ueberauth/ueberauth_github/blob/master/CHANGELOG.md

Otherwise, let me know and I merge it

@yordis yordis merged commit 2934232 into ueberauth:master May 27, 2023
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