branch: externals/oauth2
commit 6dd39033db63bdff68b2c763cc30d09a1ba07006
Author: Xiyue Deng <[email protected]>
Commit: Xiyue Deng <[email protected]>

    Also check if access-token is valid when requesting cache
    
    It's possible for a refresh token request to fail and we may end up
    with an empty acces-token in the cache.  In such case we should
    request another refresh.
    
    * oauth2.el: check access-token for cache validity.
---
 oauth2.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/oauth2.el b/oauth2.el
index 323b864247..c950c29425 100644
--- a/oauth2.el
+++ b/oauth2.el
@@ -326,6 +326,8 @@ optional but highly recommended which is required for the 
cache to work."
   (if-let* ((func-name "oauth2-refresh-access")
             (current-timestamp (oauth2--current-timestamp))
             (request-cache (oauth2-token-request-cache token))
+            (access-token (oauth2--get-from-request-cache
+                           request-cache host-name :access-token))
             (request-timestamp (or (oauth2--get-from-request-cache
                                     request-cache host-name :request-timestamp)
                                    ;; host-name could be nil, so default to 0

Reply via email to