0
Follow
0
View

How to get profile information from Google Identity Services?

dickens_csl 注册会员
2023-01-25 16:50

I just tried this again and answer #3 from google api javascript get logged in user's email worked for me this time.

Note that in my example above I had added:

gapi.client.load('https://www.googleapis.com/discovery/v1/apis/oauth2/v1/rest');

that was not in the original example that I used, after that I am able to get the user's info with:

gapi.client.oauth2.userinfo.get().execute(function (resp) {
    // Shows user email
    console.log(resp);
  })

or

(await gapi.client.oauth2.userinfo.get()).result

About the Author

Question Info

Publish Time
2023-01-25 16:50
Update Time
2023-01-25 16:50