-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch to oauth2-auto for Google Calendar OAuth2 #200
Conversation
39214bf
to
0b92319
Compare
@rhaps0dy would you mind putting oauth2-auto on Melpa? I could also do it if you don't have time. See https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org. |
All tests now pass except for 26.1, because oauth2-auto is not marked compatible with it. I've opened rhaps0dy/emacs-oauth2-auto#1 to try to fix this. |
Now passes, but only if I manually install rhaps0dy/emacs-oauth2-auto#1. If there's no response to that PR soon, I will vendor this dependency and merge. |
d8fbbbe
to
4c444a6
Compare
thanks for the work on this!! |
Hi, sorry to butt in, but will this be merged in the next couple of weeks? I think we're coming up to the October 3rd deadline for OOB migration. |
Oh, i wasn’t aware of that deadline.
very possible, there’s 1 month left. I’m trying to get oauth2-auto verified by Google and into Melpa, @telotortium has done the lion’s share of the work there.
In any case there already exist workarounds so you don’t have to stop using org-gcal.
Adrià Garriga-Alonso
… On Sep 6, 2022, at 08:56, deen1 ***@***.***> wrote:
Hi, sorry to butt in, but will this be merged in the next couple of weeks? I think we're coming up to the October 3rd deadline for OOB migration.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
@rhaps0dy Thanks for your reply! Very grateful to you and @telotortium for your work on this. Re:
Sorry for being obtuse, but I haven't yet found a suitable workaround, and there aren't any highlighted on the README. Could you point me in the right direction? FYI this is a portion of an email Google sent me a few months ago -- there's the possibility of extending to February of next year, and "testing mode" apps will not be affected, but October 3 looks like the deadline.
|
(defun org-gcal--get-access-token (calendar-id) | ||
"Return the access token for CALENDAR-ID." | ||
(aio-wait-for | ||
(oauth2-auto-access-token calendar-id 'org-gcal))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of calendar-id
it should be the user's email.
It works if the string is garbage (because it's only a login_hint
internally) so you haven't noticed the error. But this will make you log in for every calendar you have, whereas if you have the same string every time you'll only log in once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that the PR 9, which I'm going to merge at some point, changes the format to (oauth2-auto-access-token "[email protected]" 'org-gcal '(calendar))
@deen1 ,
The easy way is to install The resulting software has rough edges but it's kind of usable :) |
"Setup OAuth2 authentication after setting client ID and secret." | ||
(interactive) | ||
(add-to-list | ||
'oauth2-auto-additional-providers-alist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally you'd just be able to use 'google
and let oauth2-auto
handle everything. I understand that this way it is possible to use the existing org-gcal-client-id
and org-gcal-client-secret
, but if Google verifies oauth2-auto
, it's going to be much easier to just use its ID and secret. One more thing not to worry about :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it still work to use one secret for all clients of the library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean: if more than one program uses the library, can they all use the same secret?
I think so, and it's also nicer for the user because they only have to log in once. We'll have to verify scopes for all the possible libraries on that secret though.
For existing users of org-gcal
maybe it's better to do it like you have done it now, though. This way they don't have to modify the config.
Does this answer your q?
`(org-gcal | ||
(authorize_url . "https://accounts.google.com/o/oauth2/auth") | ||
(token_url . "https://oauth2.googleapis.com/token") | ||
(scope . "https://www.googleapis.com/auth/calendar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note also that the PR 9, which I'm going to merge at some point, changes the format to (available_scopes . (calendar . "https://www.googleapis.com/auth/calendar"))
@rhaps0dy Thanks very much! I'll probably wait to see you guys push the full thing before the deadline, but I'll have a look at your suggestions above later this week. |
I think so. I'll look again tomorrow
…On Sat, Sep 10, 2022, 17:31 Adrià Garriga-Alonso ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In org-gcal.el
<#200 (comment)>:
> @@ -2282,6 +2160,24 @@ non-nil."
(plist-get plst :year))))
+(defun org-gcal-reload-client-id-secret ()
+ "Setup OAuth2 authentication after setting client ID and secret."
+ (interactive)
+ (add-to-list
+ 'oauth2-auto-additional-providers-alist
Do you mean: if more than one program uses the library, can they all use
the same secret?
I think so, and it's also nicer for the user because they only have to log
in once. We'll have to verify scopes for all the possible libraries on that
secret though.
For existing users of org-gcal maybe it's better to do it like you have
done it now, though. This way they don't have to modify the config.
Does this answer your q?
—
Reply to this email directly, view it on GitHub
<#200 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANMVDK77NHARLNSPX4B7VTV5UR4RANCNFSM52PSDOYA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@rhaps0dy Any luck with getting Google to verify your library? |
Thank you for this! It might be exactly what I need. I have miraculously managed to, I think, follow your instructions to install the oauth2-auto branch of this fork, and the oauth2-auto as well. I don't really know how it's supposed to work, though, so I'm wondering: is it supposed to make and write to ~/.emacs.d/oauto2-auto.plist? I don't have one being made, and when I turn on the error tracking, I see errors related to the non-existence of the file, and if I touch the file first, the lack of content. What am I doing wrong? Do I need to write the file myself somehow before I use More details: I successfully log into the account (I get the "Authentication token successfully obtained by Emacs! You may close this page now." message) but when I return to Emacs I face weird errors like "wrong number of argments" given to time-date. Toggling on the error tracing gives the errors described above. I also had a lot of trouble getting cask etc to work, so something weird might have happened during installation of some parts. Thanks for any help! |
Also: moving to my home computer, where I have emacs 27 rather than 26.3, org-generic-id throws an "invalid function" error:
But when I walk through the function with a debugger, it works just fine and instead I get a mysterious error about the arguments to time-date after logging in to Gmail. I'm not sure if this is the place to report things like this, but, well in case it's useful, here it is! |
@megodoonch Thanks for the feedback - I'll try looking into this tonight when I have some time |
How do you download the oauth2-auto branch of this fork/PR? I'm not familiar enough with Github to find it. |
Yeah, that took me a few tries! When you clone someone else's repo you only get the main branch by default. I think there were two ways that worked:
for 1, try
For 2, I think it was this:
|
This allows switching from the deprecated OOB flow <https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html#disallowed-oob>, fixing <kidd#191>. As a side effect, oauth2-auto makes it straightforward to support multiple accounts (see <kidd#199>), although this PR doesn't by itself enable that.
Also vendor the current version on my branch and remove the corresponding line from Cask.
oauth2-auto is a big enough dependency and operational change to justify the bump.
deec147
to
7bcb0ab
Compare
Hi everyone, I'm planning on merging this branch as-is. I've decided to work around the fact that oauth2-auto isn't on MELPA yet by just vendoring it inside this repo. |
aio-url-retrieve sometimes hangs. Backported from kidd/org-gcal.el#200.
kidd/org-gcal.el#200 のあたりで設定方法が変わったのでそれを反映した
This allows switching from the deprecated OOB flow
https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html#disallowed-oob,
fixing #191.
As a side effect, oauth2-auto makes it straightforward to support
multiple accounts (see
#199), although this
PR doesn't by itself enable that.
@rhaps0dy