Prepopulate profile when signin up with Google#33
Open
stefanomunarini wants to merge 2 commits into
Open
Conversation
| let lastName = result.user.displayName.split(' ')[1]; | ||
| let email = result.user.email; | ||
| let pic = result.user.photoURL; | ||
| firebase.database().ref('users/' + id).set({ |
Owner
There was a problem hiding this comment.
Here you need to use .update() instead of .set(), otherwise Firebase will remove all the other fields you do not set here
Collaborator
Author
|
But this is only when the user signup, so it's a one off action. Then you can still add fields later on |
Owner
|
Actually the problem is that if I change my profile picture, every time I sign in again in the website the data from google overwrites the one in the profile on Firebase. We should check if that info exists before updating |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #25
The issue was about Facebook, but actually there was nothing for Google as well. Since I can't test for Facebook (it requires my Italian phone number for the two step verification), I implemented the Google thingy.
The new implementation provide first name, last name, email and profile pic taken from the Google account with which the user login.
Please test it as well before merging.