I am trying to implement google sign-in. I did, however the user is logging out after refresh action.
I have recently migrated to google's updated javascript client-side script API.
The code is live at Expense by Cutezero. I have used the below code to enable sign in
if (gapiInited && gisInited) {
tokenClient.callback = async (resp) => {
if (resp.error !== undefined) {
throw (resp);
}
// await listLabels();
await listFiles();
};
if (gapi.client.getToken() === null) {
// Prompt the user to select an Google Account and asked for consent to share their data
// when establishing a new session.
tokenClient.requestAccessToken({ prompt: 'consent' });
} else {
// Skip display of account chooser and consent dialog for an existing session.
tokenClient.requestAccessToken({ prompt: '' });
}
}
Please request more info in case you need it. But you can refer to the live-site to get more details.