lesander / magister-calendar

:date: Automatically plan your Magister appointments in your Google calendar.
https://git.io/magister
MIT License
11 stars 6 forks source link

Error requesting new Google OAuth2 token #31

Closed CemreSuler closed 7 years ago

CemreSuler commented 7 years ago

Last login: Wed Jul 12 08:38:46 on console iMac-van-K:~ ksuler$ /Users/ksuler/Desktop/Calendar.command ; exit; [] 14:46:39 Magister Calendar v1.8.3 started. [] System Time: 14:46:39, date: Thu, 13 Jul 2017 12:46:39 GMT [] 14:46:39 Debugging has been disabled. [] 14:46:39 Using default period to fetch appointments for. [] 14:46:39 Determined period is: From Thu Jul 13 2017 14:46:39 GMT+0200 (CEST) To Fri Jul 21 2017 14:46:39 GMT+0200 (CEST). [] 14:46:39 Google OAuth2 token has expired. Requesting a new one. /Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:219 tools.log("critical", "Problem requesting new OAuth2 token: "+result.error.errors[0].message, result.error); ^

TypeError: Cannot read property '0' of undefined at Request._callback (/Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:219:88) at Request.self.callback (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:198:22) at emitTwo (events.js:125:13) at Request.emit (events.js:213:7) at Request. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1082:10) at emitOne (events.js:120:20) at Request.emit (events.js:210:7) at IncomingMessage. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1009:12) at emitNone (events.js:110:20) at IncomingMessage.emit (events.js:207:7) logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. Deleting expired sessions...none found.

[Proces voltooid]

lesander commented 7 years ago

Thanks for reporting your issue. The problem seems to be unrelated to MagisterJS. As the log says, an error occurred while trying to obtain a new OAuth2 token from the Google Calendar API.

It seems that the Google Calendar API returned an unexpected error object. Could you please share the full response?

CemreSuler commented 7 years ago

What do I need to send, this is all terminal said

lesander commented 7 years ago

Please enable debugging on line 23 (var DEBUG = true) in the magister-calendar.js file, and then share the Google API response files saved to disk in the cache folder.

CemreSuler commented 7 years ago

It says the debug log gets saved to disk, but I can't find it

CemreSuler commented 7 years ago

Now terminal says this

Last login: Sat Jul 15 13:57:30 on ttys000 iMac-van-K:~ ksuler$ /Users/ksuler/Desktop/Calendar.command ; exit; [] 13:58:10 Magister Calendar v1.8.3 started. [] System Time: 13:58:10, date: Sat, 15 Jul 2017 11:58:10 GMT [] 13:58:10 Debugging has been enabled. Extra information will be printed, and logs/dumps saved to disk. [] 13:58:10 Using default period to fetch appointments for. [] 13:58:10 Determined period is: From Mon Jul 17 2017 13:58:10 GMT+0200 (CEST) To Sat Jul 29 2017 13:58:10 GMT+0200 (CEST). [] 13:58:10 Google OAuth2 token has expired. Requesting a new one. /Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:219 tools.log("critical", "Problem requesting new OAuth2 token: "+result.error.errors[0].message, result.error); ^

TypeError: Cannot read property '0' of undefined at Request._callback (/Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:219:88) at Request.self.callback (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:198:22) at emitTwo (events.js:125:13) at Request.emit (events.js:213:7) at Request. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1082:10) at emitOne (events.js:120:20) at Request.emit (events.js:210:7) at IncomingMessage. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1009:12) at emitNone (events.js:110:20) at IncomingMessage.emit (events.js:207:7) logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Proces voltooid]

lesander commented 7 years ago

That's the same error as before. Please look in your magister-calendar project folder for any crash logs.

CemreSuler commented 7 years ago

I looked, couldnt find anything

CemreSuler commented 7 years ago

Do you have any idea what causes this?

lesander commented 7 years ago

Please use the updated files in the crashreport-patch. See if a crash report is created now.

CemreSuler commented 7 years ago

How to patch without chaning my config settings?

lesander commented 7 years ago

Replace your magister-calendar.js file and your assets/tools.js file with the updated files.

CemreSuler commented 7 years ago

It still doesnt make a log

lesander commented 7 years ago

Have you re-enabled the debug setting? Please explain what you have tried and what you see.

CemreSuler commented 7 years ago

Oh no i did not i think

CemreSuler commented 7 years ago

Last login: Sat Jul 15 14:36:34 on ttys000 iMac-van-K:~ ksuler$ /Users/ksuler/Desktop/Calendar.command ; exit; [] 15:8:24 Magister Calendar v1.8.3 started. [] System Time: 15:08:24, date: Sat, 15 Jul 2017 13:08:24 GMT [] 15:8:24 Debugging has been enabled. Extra information will be printed, and logs/dumps saved to disk. [] 15:8:24 Using default period to fetch appointments for. [] 15:8:24 Determined period is: From Mon Jul 17 2017 15:08:24 GMT+0200 (CEST) To Sat Jul 22 2017 15:08:24 GMT+0200 (CEST). [] 15:8:24 Google OAuth2 token has expired. Requesting a new one. /Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:217 return tools.log("critical", "Problem requesting new OAuth2 token: "+result.error.errors[0].message, result.error); ^

TypeError: Cannot read property '0' of undefined at Request._callback (/Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js:217:95) at Request.self.callback (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:198:22) at emitTwo (events.js:125:13) at Request.emit (events.js:213:7) at Request. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1082:10) at emitOne (events.js:120:20) at Request.emit (events.js:210:7) at IncomingMessage. (/Users/ksuler/Desktop/magister-calendar-master/node_modules/request/request.js:1009:12) at emitNone (events.js:110:20) at IncomingMessage.emit (events.js:207:7) logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.

[Proces voltooid]

CemreSuler commented 7 years ago

https://imgur.com/a/j21nV

CemreSuler commented 7 years ago

Do you have an idea what causes this?

lesander commented 7 years ago

A mis-configuration with your Google API setup perhaps. I have no clue unless you provide me with the error responses.

CemreSuler commented 7 years ago

I do not get error responses

lesander commented 7 years ago

Yes, you do.

Try changing line 219 in /Users/ksuler/Desktop/magister-calendar-master/magister-calendar.js from:

tools.log("critical", "Problem requesting new OAuth2 token: "+result.error.errors[0].message, result.error);

to:

tools.log("critical", "Problem requesting new OAuth2 token: ", result);

And see what result gets printed to the console.

CemreSuler commented 7 years ago

Done, new error log

Last login: Mon Jul 17 18:39:43 on ttys000 iMac-van-K:~ ksuler$ /Users/ksuler/Desktop/Calendar.command ; exit; [] 21:43:34 Magister Calendar v1.8.3 started. [] System Time: 21:43:34, date: Tue, 18 Jul 2017 19:43:34 GMT [] 21:43:34 Debugging has been enabled. Extra information will be printed, and logs/dumps saved to disk. [] 21:43:34 Using default period to fetch appointments for. [] 21:43:34 Determined period is: From Wed Jul 19 2017 21:43:34 GMT+0200 (CEST) To Fri Jul 21 2017 21:43:34 GMT+0200 (CEST). [] 21:43:34 Google OAuth2 token has expired. Requesting a new one. [!] 21:43:34 Problem requesting new OAuth2 token: {"error":"invalid_request","error_description":"Missing required parameter: refresh_token"} [*] 21:43:34 Saved crash report to disk. logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed. Deleting expired sessions...none found.

[Proces voltooid]

lesander commented 7 years ago

It seems that the application does not have the refresh_token. A solution could be to re-authenticate your Google application.

CemreSuler commented 7 years ago

Thank you

CemreSuler commented 7 years ago

I created a new Google API, and added the new client_secret.json file to the Magister-Calendar-Master Folder, but I still get the same error.

lesander commented 7 years ago

Did you remove the .credentials folder in your home directory? And re-authenticated the application using the first run file?

CemreSuler commented 7 years ago

Thank you very, very much!!! Issue is closed