From a627110758886dc739bc9a4fa8c0e186d03676e8 Mon Sep 17 00:00:00 2001 From: Anders Nauman Date: Fri, 3 Nov 2023 17:04:44 +0100 Subject: [PATCH] Make sure 'code' returns None instead of crashing if key is missing. --- authlib/integrations/flask_client/apps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authlib/integrations/flask_client/apps.py b/authlib/integrations/flask_client/apps.py index 7567f4b3..84ac8c0d 100644 --- a/authlib/integrations/flask_client/apps.py +++ b/authlib/integrations/flask_client/apps.py @@ -85,12 +85,12 @@ def authorize_access_token(self, **kwargs): raise OAuthError(error=error, description=description) params = { - 'code': request.args['code'], + 'code': request.args.get('code'), 'state': request.args.get('state'), } else: params = { - 'code': request.form['code'], + 'code': request.form.get('code'), 'state': request.form.get('state'), }