There are cases when using the 'authcode' grant where the authorization
request will succeed but the access token request will fail (for
example: if the user's web browser and terminal use different proxy
settings).  The current implementation of the script does not inform
the user that the authorization token is being exchanged for an access
code, with the result that it can appear that a request has both
succeeded (according to the browser) and failed (according to the
terminal output) simultaneously.  Add a message to inform the user that
a second request is being made so there is less potential for confusion.
---
 contrib/mutt_oauth2.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/mutt_oauth2.py b/contrib/mutt_oauth2.py
index ed241fc6..52358e94 100644
--- a/contrib/mutt_oauth2.py
+++ b/contrib/mutt_oauth2.py
@@ -239,6 +239,7 @@ if args.authorize:
                   'code': authcode,
                   'client_secret': registration['client_secret'],
                   'code_verifier': verifier})
+        print('Exchanging the authorization code for an access token')
         try:
             response = urllib.request.urlopen(registration['token_endpoint'],
                                               
urllib.parse.urlencode(p).encode())
-- 
2.34.1

Reply via email to