auth-source-xoauth2
auth-source-xoauth2 copied to clipboard
Request a setting example.
Would you please put a config example in the readme to show how to set up xoauth2? That will be really helpful. Thanks
The documentation is in M-x describe-variable auth-source-xoauth2-creds
- including setting it up on Google's side. Did you find anything missing there?
I use the following in my .emacs:
(require 'auth-source-xoauth2)
(defun my-xoauth2-get-secrets (host user port)
(when (and (string= host $hostname)
(string= user $username))
(list
:token-url "https://accounts.google.com/o/oauth2/token"
:client-id (auth-source-pass-get 'secret $location-in-pass)
:client-secret (auth-source-pass-get 'secret $location-in-pass)
:refresh-token (auth-source-pass-get 'secret $location-in-pass))))
(setq auth-source-xoauth2-creds 'my-xoauth2-get-secrets)
(add-to-list 'smtpmail-auth-supported 'xoauth2)
(auth-source-xoauth2-enable)
Of course you have to replace the $-prefixed names with your values. I'm using an own function for auth-source-xoauth2-creds, because I have the xoauth2 secrets in separate pass entries.
Maybe we can add some copy&paste-ready .emacs snippet to the package's comment section?
That is very helpful! Please add to the readme.
On Sat., 21 Sep. 2019, 7:54 am sh-ow, [email protected] wrote:
I use the following in my .emacs:
(require 'auth-source-xoauth2)
(defun my-xoauth2-get-secrets (host user port) (when (and (string= host $hostname) (string= user $username)) (list :token-url "https://accounts.google.com/o/oauth2/token" :client-id (auth-source-pass-get 'secret $location-in-pass) :client-secret (auth-source-pass-get 'secret $location-in-pass) :refresh-token (auth-source-pass-get 'secret $location-in-pass))))
(setq auth-source-xoauth2-creds 'my-xoauth2-get-secrets) (add-to-list 'smtpmail-auth-supported 'xoauth2) (auth-source-xoauth2-enable)
Of course you have to replace the $-prefixed names with your values. I'm using an own function for auth-source-xoauth2-creds, because I have the xoauth2 secrets in separate pass entries.
Maybe we can add some copy&paste-ready .emacs snippet to the package's comment section?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ccrusius/auth-source-xoauth2/issues/3?email_source=notifications&email_token=AAN35ML27ENLJ7DNDR6X7OTQKVBARA5CNFSM4H7LDK7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7H7G2Q#issuecomment-533721962, or mute the thread https://github.com/notifications/unsubscribe-auth/AAN35MIBNNJI72Z4KOWA2E3QKVBARANCNFSM4H7LDK7A .
Thanks for the example. I'm not sure I'd go so far as recommending the use case for having the secrets in different pass entries for all the values. The auth-source-xoauth2-pass-creds
function provided in the package does the same thing, but with all the entries in one pass file.
The copy-and-paste suggestion is good, thanks.
As far as README documentation, I feel it is a duplicate of what should be in the package documentation. In the Emacs spirit, that's where we should clarify any questions.