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

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

[elpa] master a133262: feat(oauth2): do not include &client_secret if no


From: Julien Danjou
Subject: [elpa] master a133262: feat(oauth2): do not include &client_secret if no client_secret set
Date: Fri, 28 Aug 2020 11:21:41 -0400 (EDT)

branch: master
commit a13326224a2f3208e6fa0f38b5d26b23b8eab74b
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>
---
 packages/oauth2/oauth2.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/packages/oauth2/oauth2.el b/packages/oauth2/oauth2.el
index 570b04e..532bc13 100644
--- a/packages/oauth2/oauth2.el
+++ b/packages/oauth2/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]