>From 2b9e50cb0948e0b4f28883042109994ffa295d3d Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Sun, 21 Jul 2024 14:50:56 -0700 Subject: [PATCH 1/6] Show full authentication URL to let user choose how to visit it * packages/oauth2/oauth2.el (oauth2-request-authorization): show full authentication URL in user prompt. --- oauth2.el | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/oauth2.el b/oauth2.el index 7da9702004..3a3e50ad2b 100644 --- a/oauth2.el +++ b/oauth2.el @@ -57,14 +57,17 @@ "Request OAuth authorization at AUTH-URL by launching `browse-url'. CLIENT-ID is the client id provided by the provider. It returns the code provided by the service." - (browse-url (concat auth-url - (if (string-match-p "\?" auth-url) "&" "?") - "client_id=" (url-hexify-string client-id) - "&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)) ""))) - (read-string "Enter the code your browser displayed: ")) + (let ((url (concat auth-url + (if (string-match-p "\?" auth-url) "&" "?") + "client_id=" (url-hexify-string client-id) + "&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)) "")))) + (browse-url url) + (read-string (concat "Follow the instruction on your default browser, or " + "visit:\n" url + "\nEnter the code your browser displayed: ")))) (defun oauth2-request-access-parse () "Parse the result of an OAuth request." -- 2.39.2