I'm porting over some existing js code authenticating with the google cloud platform (as they are migrating to a new set of libraries).
(migration guide: https://developers.google.com/identity/oauth2/web/guides/migration-to-gis)
I'm struggling with getting a hold of the player's profile (to obtain their email).
The old approach would be along the lines of this (but as it says, it is now deprecated - I've been reading the new docs but it mostly surrounds getting authorized/authenticate and not the follow on from that): https://developers.google.com/identity/sign-in/web/people
e.g.
var profile = auth2.currentUser.get().getBasicProfile();
var email = profile.getEmail();
In my new code I've have the access token, via the new approach:
client_id: vm.clientId,
scope: SCOPE,
callback: (tokenResponse) => {
if (tokenResponse && tokenResponse.access_token) {
access_token = tokenResponse.access_token;
// HERE??? HOW DO I GET THE PROFILE?
}
}
})
(largely taken from https://developers.google.com/identity/oauth2/web/guides/use-token-model)
I've seen this mentioned elsewhere but it doesn't work in my situation at least:
gapi.client.oauth2.userinfo.get().execute(function (resp) {
console.log(resp);
})
(How to get profile information from Google Identity Services?)
I've read via the migration guide: 'Instead, use direct references to credential sub-fields in the new JWT CredentialResponse object to work with user profile data.' but don't know how to get this Credentialresponse? (https://developers.google.com/identity/gsi/web/guides/migration#token_response)