From 53bb4d1a55affcdff073febe29b90d19f3603525 Mon Sep 17 00:00:00 2001 From: Naoya Yamashita Date: Fri, 19 Feb 2021 20:25:36 +0900 Subject: [PATCH] * packages/oauth2/oauth2.el: Use client-id and secret to compute id (oauth2-compute-id): Add client-id client-secret as new argument to compute plstore unique id. (oauth2-auth-and-store): Fix the function usage. --- oauth2.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/oauth2.el b/oauth2.el index 0099e06217..519ff46d17 100644 --- a/oauth2.el +++ b/oauth2.el @@ -158,17 +158,17 @@ TOKEN should be obtained with `oauth2-request-access'." :group 'oauth2 :type 'file) -(defun oauth2-compute-id (auth-url token-url scope) +(defun oauth2-compute-id (auth-url token-url scope &optional client-id client-secret) "Compute an unique id based on URLs. This allows to store the token in an unique way." - (secure-hash 'md5 (concat auth-url token-url scope))) + (secure-hash 'md5 (concat auth-url token-url scope client-id client-secret))) ;;;###autoload (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 using `plstore'." ;; We store a MD5 sum of all URL (let* ((plstore (plstore-open oauth2-token-file)) - (id (oauth2-compute-id auth-url token-url scope)) + (id (oauth2-compute-id auth-url token-url scope client-id client-secret)) (plist (cdr (plstore-get plstore id)))) ;; Check if we found something matching this access (if plist -- 2.30.0