Skip to content

Merge improvements from anonymous auth PR (#309) #808

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

Merged
merged 2 commits into from
Jul 19, 2017
Merged

Merge improvements from anonymous auth PR (#309) #808

merged 2 commits into from
Jul 19, 2017

Conversation

SUPERCILEX
Copy link
Collaborator

@samtstern While working on automatically merging user profiles for #309, I made several improvements worth merging back into master:

  • We no longer show that annoying Twitter request email screen!!! 😄🚀 I always knew we were doing it wrong somehow since the Firebase apis could get the Twitter email without showing that screen and that's correct--you can get profile info from the current Twitter session.
  • The IdpResponse user data is unified and uses our User object under the hood now
  • We collect all possible user info from all providers (we aren't using this yet, but it's used in Support account linking #309 and could be useful for other things in the future.)

Copy link
Contributor

@samtstern samtstern left a comment

Choose a reason for hiding this comment

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

@SUPERCILEX thanks for doing this! Excited about the Twitter improvements. Just a few questions.

Also we should target 2.1.1-dev not master.

if ((providerId.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)
|| providerId.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)
|| providerId.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)
|| providerId.equalsIgnoreCase(GithubAuthProvider.PROVIDER_ID))
Copy link
Contributor

Choose a reason for hiding this comment

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

What's github doing here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lol, must have been a merge mistake from a long time ago.


try {
email = object.getString("email");
} catch (JSONException ignored) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we at least log a warning if we can't get email?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup.

TwitterCore.getInstance()
.getApiClient()
.getAccountService()
.verifyCredentials(false, false, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment documenting the false, false, true magic sequence?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TBH, I just copied that from StackOverflow 😆. I did a bit of debugging and figured some of it out (in order): includeEntities will populate the User#entities field but we don't need it, skipStatus I have no idea what that does, includeEmail includes the email (duh! 😄).

Do you want me to document the parameter names? Intellij shows them, but it could be useful for GitHub:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

That's alright, thanks for clarifying!

}

private IdpResponse(
String providerId,
String email,
User user,
String phoneNumber,
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason why email was merged into User but not phoneNumber?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch!

Signed-off-by: Alex Saveau <[email protected]>
@samtstern
Copy link
Contributor

@SUPERCILEX last thing left is to target the 2.1.1-dev branch.

@SUPERCILEX SUPERCILEX changed the base branch from master to version-2.1.1-dev July 19, 2017 19:55
@SUPERCILEX
Copy link
Collaborator Author

@samtstern Oops, I've updated the base now.

@samtstern samtstern merged commit d995eb7 into firebase:version-2.1.1-dev Jul 19, 2017
@SUPERCILEX SUPERCILEX deleted the anonymous-auth-improvements branch July 19, 2017 20:00
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