P
P
Peter H2017-11-03 14:41:17
JavaScript
Peter H, 2017-11-03 14:41:17

Google Calendar API (JS), authorization problems, how to solve?

I am using the Google Calendar API to add events to my calendar. I want every user who comes to my site to be able to enter data and add an entry to my calendar. The problem is that in order to complete a request to add, authorization is needed, as I understand it. But not every user on my site has a Google account, they don't have to log in to add a post to me. And besides, if they log in, they will add an entry not to my calendar, but to themselves ... Is it possible for me to log in somehow, write down the token, etc., so that it always works, and the user already using my authorization data, added an entry to my google calendar?
At the moment, initialization and writing looks like this:
window.gapi.client.init({
apiKey: 'AIzaSyCnwaF2SL1m-Ra-o7ZLlbKz2p83WwCv_eI', clientId :
'929440583804-ji2d98at7p118g7u4qdio5fvggs21cqs.apps.googleusercontent.com',
scope: ' https://www.googleapis.com/auth/calendar ',
discoveryDocs: discoveryDocs www.googleapis.com/discovery/v1/apis/calen... '],
immediate: true
}).then(function(response) {
console.log('initiated');
}, function(reason) {
console. log(reason);
});
let request = window.gapi.client.calendar.events.insert({
'calendarId': 'myCalId',
'resource': eventObject
});
request.execute(function(event){});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question