GNU bug report logs -
#79242
30.1; [ELPA] More proposed improvements for oauth2
Previous Next
Full log
Message #17 received at 79242 <at> debbugs.gnu.org (full text, mbox):
This helps with using predefined `client-id'/`client-secret' and
preset the user login email when requesting the first authorization.
* packages/oauth2/oauth2.el (oauth2-request-authorization): Add
`user-name' parameter and set as `login_hint'.
* packages/oauth2/oauth2.el (oauth2-auth): Add `user-name' parameter
and pass through `oauth2-request-authorization'.
* packages/oauth2/oauth2.el (oauth2-auth-and-store): Pass `user-name'
through `oauth2-auth'.
---
oauth2.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/oauth2.el b/oauth2.el
index 72c5c5dce3..18a372075f 100644
--- a/oauth2.el
+++ b/oauth2.el
@@ -147,14 +147,16 @@ address to build the full URL."
(concat address "?" data-str)))
(defun oauth2-request-authorization (auth-url client-id &optional scope state
- redirect-uri)
+ redirect-uri user-name)
"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
for desktop application is usually \"urn:ietf:wg:oauth:2.0:oob\". SCOPE
identifies the resources that your application can access on the user's
behalf. STATE is a string that your application uses to maintain the
-state between the request and redirect response.
+state between the request and redirect response. USER-NAME is used to
+provide the login_hint which will fill the login user name on the
+requesting webpage to save users some typing.
Returns the code provided by the service."
(let* ((func-name "oauth2-request-authorization")
@@ -165,6 +167,7 @@ Returns the code provided by the service."
(or redirect-uri oauth2--default-redirect-uri)
"scope" scope
"state" state
+ "login_hint" user-name
"access_type" "offline"
"prompt" "consent")))
(oauth2--do-trivia "[%s]: url: %s" func-name url)
@@ -280,15 +283,15 @@ TOKEN should be obtained with `oauth2-request-access'."
;;;###autoload
(defun oauth2-auth (auth-url token-url client-id client-secret
- &optional scope state redirect-uri)
+ &optional scope state redirect-uri user-name)
"Authenticate application via OAuth2."
(oauth2-request-access
auth-url
token-url
client-id
client-secret
- (oauth2-request-authorization
- auth-url client-id scope state redirect-uri)
+ (oauth2-request-authorization auth-url client-id scope state redirect-uri
+ user-name)
redirect-uri))
(defun oauth2-compute-id (auth-url token-url scope client-id user-name)
@@ -338,7 +341,7 @@ Returns an `oauth2-token'."
(oauth2--do-trivia "[%s]: requesting new oauth2-token." func-name)
(let ((token (oauth2-auth auth-url token-url
client-id client-secret scope state
- redirect-uri)))
+ redirect-uri user-name)))
;; Set the plstore
(setf (oauth2-token-plstore-id token) plstore-id)
(oauth2--update-plstore plstore token)
--
2.47.2
This bug report was last modified 4 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.