How to access phone number in google one tap user profile

Viewed 47

We're doing a POC implementation of Google One Tap sign in on our site. Set up was relatively simple and the service is working as expected. I'm curious if it's possible to get the phone number from the user profile. The documentation doesn't directly reference the phone number and the return object from my test profile (which includes a phone number and has both Better Sharing and Better Ads enabled) doesn't include the field.

Can this be done? If so, how?

Here's what we're using:

const onOneTapSignedIn = (response: any) => {
  const decodeToken: GoogleUser = jwt_decode(response.credential);
  setLocalStorage('googleUser', {
    email: decodeToken.email,
    familyName: decodeToken.family_name,
    givenName: decodeToken.given_name,
    name: decodeToken.name,
    picture: decodeToken.picture,
  });
};
0 Answers
Related