I'm trying to create a login button "Sign In With Google" and get additional information about the user (name, email + gender and date of birth) using the People API.
I have done this before with https://apis.google.com/js/api.js.
This library provides tools for authorization and requests, but Google stops support and offers to use a new option.
I followed this guide Load the client library + Display the Sign In With Google button.
In the end result (after decoding the JWT token) I get the name and email. To send a request to People API, I need an access_token. Where and how can i get it without server-side scripts?
Can someone tell me how to send a request to People API with JS in this case?
There's demo javascript code on the People API docs website: https://developers.google.com/people/quickstart/js
It lists the account's contacts, but you can easily modify that to only get the user's details.
I have checked the documentation from the new Google Sign in Library and it seems that the access token is not included in the JWT token that is retrieved, it seems that this has been changed to handle the information gathered from the token response as documented here.