From 4f6628439bdee67025719314bab5b824c86d19e9 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Sun, 21 Jul 2024 14:52:02 -0700 Subject: [PATCH 2/6] Add parameters required by Google OAuth2 to get refresh_token * packages/oauth2/oauth2.el (oauth2-request-authorization): add "access_type=offline" and "prompt=consent" when requesting token to receive refresh_token. (Bug#72358) --- oauth2.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oauth2.el b/oauth2.el index 3a3e50ad2b..8371e73ffb 100644 --- a/oauth2.el +++ b/oauth2.el @@ -63,7 +63,11 @@ It returns the code provided by the service." "&response_type=code" "&redirect_uri=" (url-hexify-string (or redirect-uri "urn:ietf:wg:oauth:2.0:oob")) (if scope (concat "&scope=" (url-hexify-string scope)) "") - (if state (concat "&state=" (url-hexify-string state)) "")))) + (if state (concat "&state=" (url-hexify-string state)) "") + ;; The following two parameters are required for Gmail + ;; OAuth2 to generate the refresh token + "&access_type=offline" + "&prompt=consent"))) (browse-url url) (read-string (concat "Follow the instruction on your default browser, or " "visit:\n" url -- 2.39.2