I am using google-signin element from Google Web Components, but I don't know how to return user info.
<google-signin
client-id="{{my-id}}" scopes="email profile"
signed-in="{{signedIn}}"></google-signin>
I tried to write some JS function but it didn't work.
function (signedIn) {
var profile = gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile();
console.log('Name: ' + profile.getName());
console.log('Image: ' + profile.getImageUrl());
}
Excuse me if this is stupid questions, but I am not good at web developing. Thank you for your advice.
From polymer documentation:
https://elements.polymer-project.org/elements/google-signin
Or you can use:
And then you can get username name like that:
Here you can find the full demo: https://github.com/GoogleWebComponents/google-signin/blob/master/demo/index.html