Outlook calendar sync failing after OAuth change

Post

Posted
Rating:
#1 (In Topic #2055)
Avatar
Trainee
Jeston is in the usergroup ‘Trainee’

Hi all,

I wrote a small Gambas app to pull my Outlook calendar and mirror it locally. I expected the Microsoft calendar sync to behave once WebDAV / CalDAV was set up, but that’s not what I’m seeing. It imports the events fine the first time, then stops updating completely. This started right after I enabled OAuth on my Microsoft 365 account. Since then I only get 401 errors on the HTTP requests from Gambas. Curl still connects, so the endpoint is alive. I’m no network guru, so I might be missing something obvious. Has anyone here managed a reliable Outlook calendar sync from Gambas?

Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
sholzy is in the usergroup ‘unknown’
I'm not a network guy either, and I've never tried connecting in any other way than FTP.

A few questions…
What have you done to troubleshoot the problem.
Have you tried disabling OAuth for testing?


I'm wondering if it might be a password issue?

Hopefully someone here with network knowledge will drop in and be able to help.


:welcome:

sholzy
Gambas One Site Director

To help make creating posts and using the forum a little easier:
Tutorials - Website and forum and Playground 

To report bugs in the Gambas IDE:
Official Gambas Bug Tracker
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Trainee
Jeston is in the usergroup ‘Trainee’
Thanks for the reply!

I've verified the credentials and the endpoint URL multiple times. The fact that curl still works suggests the server is fine, but my Gambas implementation is likely failing to pass the OAuth token correctly in the HTTP header. I can't really disable OAuth for testing because Microsoft has been deprecating Basic Auth for Microsoft 365. It's pretty much mandatory now, which is why the old-school password method doesn't work anymore. I suspect I need to better handle the Authorization: Bearer <token> header within my Gambas HttpClient calls for synchronize microsoft calendars. I'll try to debug the exact header string I'm sending vs what curl does. If anyone has a snippet of how they handle token refresh in Gambas, I’m all ears
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Trainee
supertunaman is in the usergroup ‘Trainee’
Check all the headers. I've noticed that some stuff is super picky about User-Agent strings, cookies, Accept headers even. Start with making sure that every header you pass into curl matches what you have in Gambas.

On user-agent strings, I generally try not to lie in my applications. That said, sometimes you just can't get through unless you look or act like a browser.
Online now: No Back to the top
1 guest and 0 members have just viewed this.