I have question regarding google calendar, and hope you can help me.
I have access_token from google calendar and that access_token
was stored in localStorage
.
const googleAccessToken = e.vc.access_token;
localStorage.setItem('googleAccessToken', googleAccessToken);
Now please help me understand how can I use this to avoid authorization every time.
For example I want to delete all events, And for that I wrote this code, and this code every time wants from me authorization:
const handleDisconnect = () => {
gapi.load('client:auth2', () => {
console.log('loaded client');
gapi.client.init({
apiKey: API_KEY,
clientId: CLIENT_ID,
discoveryDocs: DISCOVERY_DOCS,
scope: SCOPES_CLEAR,
});
gapi.client.load('calendar', 'v3', () => {
console.log('sdsd');
});
gapi.auth2
.getAuthInstance()
.signIn()
.then(() => {
var events = bb;
var makeRequest = resource => {
console.log(resource);
var request = gapi.client.calendar.calendars.clear({
calendarId: 'primary',
});
request.execute(resp => {
console.log(resp);
});
};
for (var j = 0; j < events.length; j++) {
makeRequest(events[j]);
}
});
});
};
Please help me to fixed that code with access_token
for avoiding authorization