Skip to content

Prepopulate profile when signin up with Google#33

Open
stefanomunarini wants to merge 2 commits into
alessandrocapra:masterfrom
stefanomunarini:feature/prepopulate_info_google_signup
Open

Prepopulate profile when signin up with Google#33
stefanomunarini wants to merge 2 commits into
alessandrocapra:masterfrom
stefanomunarini:feature/prepopulate_info_google_signup

Conversation

@stefanomunarini
Copy link
Copy Markdown
Collaborator

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.

let lastName = result.user.displayName.split(' ')[1];
let email = result.user.email;
let pic = result.user.photoURL;
firebase.database().ref('users/' + id).set({
Copy link
Copy Markdown
Owner

@alessandrocapra alessandrocapra Dec 22, 2016

Choose a reason for hiding this comment

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

Here you need to use .update() instead of .set(), otherwise Firebase will remove all the other fields you do not set here

@stefanomunarini
Copy link
Copy Markdown
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

@alessandrocapra
Copy link
Copy Markdown
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

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