1
1
import datetime
2
2
import uuid
3
3
4
- from authlib .common .urls import add_params_to_uri
5
4
from authlib .integrations .flask_oauth2 import current_token
6
5
from authlib .jose import jwt
7
6
from authlib .jose .errors import JoseError
@@ -151,15 +150,7 @@ def authorize_consent(client, user):
151
150
)
152
151
153
152
if client_has_user_consent :
154
- response = authorization .create_authorization_response (grant_user = user )
155
-
156
- # Manually implement RFC9207 until this is implemented upstream in authlib
157
- # https://github.com/lepture/authlib/pull/700
158
- response .location = add_params_to_uri (
159
- response .location , {"iss" : get_issuer ()}
160
- )
161
-
162
- return response
153
+ return authorization .create_authorization_response (grant_user = user )
163
154
164
155
elif request .args .get ("prompt" ) == "none" :
165
156
response = {
@@ -172,9 +163,8 @@ def authorize_consent(client, user):
172
163
try :
173
164
grant = authorization .get_consent_grant (end_user = user )
174
165
except OAuth2Error as error :
175
- response = {** dict (error .get_body ()), "iss" : get_issuer ()}
176
- current_app .logger .debug ("authorization endpoint response: %s" , response )
177
- return jsonify (response )
166
+ current_app .logger .debug ("authorization endpoint response: %s" , error )
167
+ return {** dict (error .get_body ()), "iss" : get_issuer ()}, error .status_code
178
168
179
169
form = AuthorizeForm (request .form or None )
180
170
return render_template (
@@ -219,10 +209,6 @@ def authorize_consent(client, user):
219
209
220
210
response = authorization .create_authorization_response (grant_user = grant_user )
221
211
222
- # Manually implement RFC9207 until this is implemented upstream in authlib
223
- # https://github.com/lepture/authlib/pull/700
224
- response .location = add_params_to_uri (response .location , {"iss" : get_issuer ()})
225
-
226
212
current_app .logger .debug ("authorization endpoint response: %s" , response .location )
227
213
return response
228
214
0 commit comments