I have implemented the new Google Identity Services to get an access_token to call the Youtube API. I try to use this on an Angular app.
this.tokenClient = google.accounts.oauth2.initTokenClient({
client_id: googleApiClientId,
scope: 'https://www.googleapis.com/auth/youtube.readonly',
callback: (tokenResponse) => {
this.accessToken = tokenResponse.access_token;
},
});
When I call this.tokenClient.requestAccessToken(), I can get an access token and use the Youtube API, that works.
But after one our, this token expire. I have this error : "Request had invalid authentication credentials."
How can I get the new refreshes access_token transparently for the user ?