Package: emacs;
Reported by: Xiyue Deng <manphiz <at> gmail.com>
Date: Mon, 4 Aug 2025 00:00:01 UTC
Severity: normal
Found in version 30.1
Done: Sean Whitton <spwhitton <at> spwhitton.name>
View this message in rfc822 format
From: Xiyue Deng <manphiz <at> gmail.com> To: 79168 <at> debbugs.gnu.org Cc: Xiyue Deng <manphiz <at> gmail.com> Subject: bug#79168: [PATCH 06/11] Reformat most lines to be less than 80 characters long Date: Sun, 3 Aug 2025 17:20:44 -0700
--- oauth2.el | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/oauth2.el b/oauth2.el index ba7125e79b..4541893346 100644 --- a/oauth2.el +++ b/oauth2.el @@ -50,7 +50,8 @@ (defgroup oauth2 nil "OAuth 2.0 Authorization Protocol." :group 'comm - :link '(url-link :tag "Savannah" "https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/?h=externals/oauth2") + :link '(url-link :tag "Savannah" + "https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/?h=externals/oauth2") :link '(url-link :tag "ELPA" "https://elpa.gnu.org/packages/oauth2.html")) (defcustom oauth2-token-file (concat user-emacs-directory "oauth2.plstore") @@ -70,7 +71,8 @@ (setcar msg (concat "[oauth2] " (car msg))) (apply #'message msg))) -(defun oauth2-request-authorization (auth-url client-id &optional scope state redirect-uri) +(defun oauth2-request-authorization (auth-url client-id &optional scope state + redirect-uri) "Request OAuth authorization at AUTH-URL by launching `browse-url'. CLIENT-ID is the client id provided by the provider which uses REDIRECT-URI when requesting an access-token. The default redirect_uri @@ -84,7 +86,9 @@ Returns the code provided by the service." (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")) + "&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)) "") ;; The following two parameters are required for Gmail @@ -127,7 +131,8 @@ Returns the code provided by the service." token-url access-response) -(defun oauth2-request-access (token-url client-id client-secret code &optional redirect-uri) +(defun oauth2-request-access (token-url client-id client-secret code + &optional redirect-uri) "Request OAuth access. TOKEN-URL is the URL for making the request. CLIENT-ID and CLIENT-SECRET are provided by the service provider. The CODE should be @@ -165,8 +170,10 @@ TOKEN should be obtained with `oauth2-request-access'." (oauth2-token-token-url token) (concat "client_id=" (oauth2-token-client-id token) (when (oauth2-token-client-secret token) - (concat "&client_secret=" (oauth2-token-client-secret token))) - "&refresh_token=" (oauth2-token-refresh-token token) + (concat "&client_secret=" + (oauth2-token-client-secret token))) + "&refresh_token=" + (oauth2-token-refresh-token token) "&grant_type=refresh_token"))))) ;; If the token has a plstore, update it (let ((plstore (oauth2-token-plstore token))) @@ -183,7 +190,8 @@ TOKEN should be obtained with `oauth2-request-access'." token) ;;;###autoload -(defun oauth2-auth (auth-url token-url client-id client-secret &optional scope state redirect-uri) +(defun oauth2-auth (auth-url token-url client-id client-secret + &optional scope state redirect-uri) "Authenticate application via OAuth2." (oauth2-request-access token-url @@ -199,7 +207,8 @@ This allows to store the token in an unique way." (secure-hash 'sha512 (concat auth-url token-url scope client-id))) ;;;###autoload -(defun oauth2-auth-and-store (auth-url token-url scope client-id client-secret &optional redirect-uri state) +(defun oauth2-auth-and-store (auth-url token-url scope client-id client-secret + &optional redirect-uri state) "Request access to a resource and store it. AUTH-URL and TOKEN-URL are provided by the service provider. CLIENT-ID and CLIENT-SECRET should be generated by the service provider when a @@ -225,7 +234,8 @@ Returns an `oauth2-token'." :token-url token-url :access-response (plist-get plist :access-response)) (let ((token (oauth2-auth auth-url token-url - client-id client-secret scope state redirect-uri))) + client-id client-secret scope state + redirect-uri))) ;; Set the plstore (setf (oauth2-token-plstore token) plstore) (setf (oauth2-token-plstore-id token) id) @@ -250,7 +260,8 @@ Returns an `oauth2-token'." (defun oauth2-extra-headers (extra-headers) "Return EXTRA-HEADERS with `Authorization: Bearer' added." - (cons (oauth2-authz-bearer-header (oauth2-token-access-token (car oauth2--token-data))) + (cons (oauth2-authz-bearer-header + (oauth2-token-access-token (car oauth2--token-data))) extra-headers)) @@ -273,7 +284,9 @@ Returns an `oauth2-token'." #'oauth2--url-http-handle-authentication-hack) ;;;###autoload -(defun oauth2-url-retrieve-synchronously (token url &optional request-method request-data request-extra-headers) +(defun oauth2-url-retrieve-synchronously (token url &optional request-method + request-data + request-extra-headers) "Retrieve an URL synchronously using TOKEN to access it. TOKEN can be obtained with `oauth2-auth'. REQUEST-METHOD, REQUEST-DATA, and REQUEST-EXTRA-HEADERS are used when retrieving URL. See also @@ -287,15 +300,16 @@ and REQUEST-EXTRA-HEADERS are used when retrieving URL. See also (url-retrieve-synchronously url)))) ;;;###autoload -(defun oauth2-url-retrieve (token url callback &optional - cbargs - request-method request-data request-extra-headers) +(defun oauth2-url-retrieve (token url callback + &optional cbargs request-method request-data + request-extra-headers) "Retrieve an URL asynchronously using TOKEN to access it. TOKEN can be obtained with `oauth2-auth'. CALLBACK gets called with CBARGS when finished. TOKEN can be obtained with `oauth2-auth'. REQUEST-METHOD, REQUEST-DATA, and REQUEST-EXTRA-HEADERS are used when retrieving URL. See also `url-retrieve'." - ;; TODO add support for SILENT and INHIBIT-COOKIES. How to handle this in `url-http-handle-authentication'. + ;; TODO add support for SILENT and INHIBIT-COOKIES. How to handle this in + ;; `url-http-handle-authentication'. (let* ((oauth2--token-data (cons token url))) (let ((oauth2--url-advice t) ;Activate our advice. (url-request-method request-method) -- 2.39.5
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.