emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/oauth2 9108df0 20/23: feat(oauth2): do not include &cli


From: Stefan Monnier
Subject: [elpa] externals/oauth2 9108df0 20/23: feat(oauth2): do not include &client_secret if no client_secret set
Date: Tue, 1 Dec 2020 16:32:01 -0500 (EST)

branch: externals/oauth2
commit 9108df08f978f97f1f0c331457c9ce4b7c4432ec
Author: Julien Danjou <julien@danjou.info>
Commit: Julien Danjou <julien@danjou.info>

    feat(oauth2): do not include &client_secret if no client_secret set
    
    Some providers do not like having client_secret passed when it is empty.
    
    Thanks Andrew Cohen <acohen@ust.hk>
---
 oauth2.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/oauth2.el b/oauth2.el
index 570b04e..532bc13 100644
--- a/oauth2.el
+++ b/oauth2.el
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2011-2020 Free Software Foundation, Inc
 
 ;; Author: Julien Danjou <julien@danjou.info>
-;; Version: 0.13
+;; Version: 0.14
 ;; Keywords: comm
 
 ;; This file is part of GNU Emacs.
@@ -90,7 +90,8 @@ Return an `oauth2-token' structure."
             token-url
             (concat
              "client_id=" client-id
-             "&client_secret=" client-secret
+            (when client-secret
+               (concat  "&client_secret=" client-secret))
              "&code=" code
              "&redirect_uri=" (url-hexify-string (or redirect-uri 
"urn:ietf:wg:oauth:2.0:oob"))
              "&grant_type=authorization_code"))))
@@ -110,7 +111,8 @@ TOKEN should be obtained with `oauth2-request-access'."
                     (oauth2-make-access-request
                      (oauth2-token-token-url token)
                      (concat "client_id=" (oauth2-token-client-id token)
-                             "&client_secret=" (oauth2-token-client-secret 
token)
+                            (when (oauth2-token-client-secret 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]