dengste / org-caldav

Caldav sync for Emacs orgmode
GNU General Public License v3.0
712 stars 105 forks source link

Google OAuth 2.0 failing with Error 400: invalid_request #284

Open AbeEtan opened 10 months ago

AbeEtan commented 10 months ago

image

Hello lovely people!

I have done everything right, but I am getting this error. Any idea on how to fix this error?

Thank you!

jackkamm commented 10 months ago

What do the error details say?

grauschnabel commented 9 months ago

Same here:

Fehler 400: invalid_request The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow migration guide linked in the developer docs below to migrate your app to an alternative method. Anfragedetails: redirect_uri=urn:ietf:wg:oauth:2.0:oob

The oauth2 libraray uses the out of band mechanism which is no longer supported by google. Also the other way the loopback method is no longer supported.

I tried to fix that but it seems that you need to use a google sdk for that now. Maybe someone knows more about that?

grauschnabel commented 9 months ago

It seems that there is a fix: https://github.com/kidd/org-gcal.el/issues/191 . It is basically they switchend from oauth2 to oauth2-auto

jackkamm commented 7 months ago

Looks like @MartinNowak is working on getting oauth2-auto into MELPA, in this comment he says it is with org-caldav in mind:

https://github.com/telotortium/emacs-oauth2-auto/issues/3#issuecomment-1703777365

@MartinNowak have you started working on modifying org-caldav to use oauth2-auto? I am not currently using org-caldav with Google, so any help is appreciated.

jackkamm commented 7 months ago

Link to duplicate version of this issue: https://github.com/dengste/org-caldav/issues/249

boogsbunny commented 4 months ago

The PR has been merged in and oauth2-auto is now in MELPA.

grauschnabel commented 4 months ago

Does this mean it should work again? In this case, is there more information about how to use it?

AbeEtan commented 4 months ago

Does this mean it should work again? In this case, is there more information about how to use it?

Yes, it's working like a charm :)

Just follow the instructions.

Make sure you enable both Calendar and Caldav APIs. If you need more help don't hesitate to ask me.

grauschnabel commented 4 months ago

Oh, I think I know my issue. Could you just give a short hint how to switch from oauth2 to oauth2-auto ?

AbeEtan commented 4 months ago

Oh, I think I know my issue. Could you just give a short hint how to switch from oauth2 to oauth2-auto ?

Definitely!

Please go here and follow the installation instructions. They should be the exact same whether you use org-gcal or org-caldav.

https://github.com/emacsmirror/org-gcal?tab=readme-ov-file#installation

Please do not hesitate to ask again if you have any concerns or questions.

Abe

grauschnabel commented 4 months ago

If i remove the oauth2 package org-caldav says oauth2 is missing, but the oauth2-auto is installed. If i install the oauth2 package again, i get the Error 400 again. For me it looks like org-caldav has to do changes to use oauth2-auto instead of oauth2. I don't figure out how you did it.

grauschnabel commented 4 months ago

After all I could fetch my google events with org-gcal, but I don't get it working with org-caldav. Can you help me with that?

AbeEtan commented 4 months ago

After all I could fetch my google events with org-gcal, but I don't get it working with org-caldav. Can you help me with that?

Can you please share your config in your init file. Possibly share a screenshot of the error you are facing.

boogsbunny commented 4 months ago

I'm not sure why @AbeEtan says it's fixed. It's not.

The oauth2-auto package has recently been added to MELPA, which uses the new oauth flow. However, it hasn't been integrated with this repository yet. We still need a PR for Google to work again.

grauschnabel commented 4 months ago

Thanks, @boogsbunny, thats exactly what i thought.

AbeEtan commented 4 months ago

I am able to sync with my google calendar and bidirectional as well. No issues what so ever.

grauschnabel commented 4 months ago

@AbeEtan Are you sure you are using org-caldav for that? Seems wired, because if you look at the code, you will see, there is no code from oauth2-auto used, only oauth2 is implemented.

Or is there a way to authenticate with oauth2-auto and reuse it with oauth2? So maybe you can explain what exactly you are doing to get it working?

I also got it working with org-gcal, but the solution is not what I want, I would have to make all apointments new because of the id handling there.

AbeEtan commented 4 months ago

I apologize for the miscommunication. I am using oauth2 and not oauth2-auto.

That being said, oauth2 works but malfunctions constantly and I have to re-authenticate again. A similar issue is reported here: https://github.com/dengste/org-caldav/issues/152

When re-authenticate, I get a warning message Warning (org-roam): SQL constraint violation: "UNIQUE constraint failed: nodes.id", 19, nil, "constraint failed"