Hi Team,
I am developing a project to read all Gmail inbox mails through my ionic app.
I created Oauth client id and Api key using “google console platform”
and i calling this function to init the google
const scopes = [‘https://mail.google.com/’,
'https://www.googleapis.com/auth/gmail.labels’].join(’ ');
const payload = new Promise((resolve) => {
gapi.load(‘auth2’, resolve);
});
return payload.then(async () => {
await gapi.auth2
.init({
client_id: this.clientId,
access_type: ‘offline’,
login_hint:me,
include_granted_scopes: true,
state:‘state_parameter_passthrough_value’,
scope:scopes
})
.then(auth => {
this.gapiSetup = true;
this.authInstance = auth;
});
}).catch(e => {
console.log(‘Error initiating Google auth’);
console.log(e);
this.authenticate();
return;
});
I am getting below error, i hav
gapi.auth2.ExternallyVisibleError: gapi.auth2 has been initialized with different options. Consider calling gapi.auth2.getAuthInstance() instead of gapi.auth2.init().
But the google docs mentioned init function only for to get the details
How to resolve this error?
Thanks in advance