Skip to content

Commit b84d1f1

Browse files
committed
doc: fix a missing exception var in the Flask authorization server example
1 parent fb50de3 commit b84d1f1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/flask/2/authorization-server.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,10 @@ Now define an endpoint for authorization. This endpoint is used by
175175
if request.method == 'GET':
176176
try:
177177
grant = server.get_consent_grant(end_user=current_user)
178-
except OAuth2Error:
178+
except OAuth2Error as error:
179179
return authorization.handle_error_response(request, error)
180180

181-
client = grant.client
182-
scope = client.get_allowed_scope(grant.request.scope)
181+
scope = grant.client.get_allowed_scope(grant.request.scope)
183182

184183
# You may add a function to extract scope into a list of scopes
185184
# with rich information, e.g.
@@ -188,13 +187,14 @@ Now define an endpoint for authorization. This endpoint is used by
188187
'authorize.html',
189188
grant=grant,
190189
user=current_user,
191-
client=client,
192190
scopes=scopes,
193191
)
192+
194193
confirmed = request.form['confirm']
195194
if confirmed:
196195
# granted by resource owner
197196
return server.create_authorization_response(grant_user=current_user)
197+
198198
# denied by resource owner
199199
return server.create_authorization_response(grant_user=None)
200200

0 commit comments

Comments
 (0)