Fix WWW-Authenticate
header on 401
This commit is contained in:
parent
29eb0304e5
commit
7b44beb1fd
2 changed files with 7 additions and 2 deletions
|
@ -39,9 +39,9 @@ api.decorators = [csrf_protect,
|
|||
@crossdomain(origin='*', headers=['Authorization', 'Content-Type'])
|
||||
def handle_api_error(error):
|
||||
response = Response(json.dumps(error.to_dict()), error.status_code, mimetype='application/problem+json')
|
||||
if error.status_code is 401:
|
||||
if error.status_code == 401:
|
||||
response.headers['WWW-Authenticate'] = ('Bearer error="%s" error_description="%s"' %
|
||||
(error.error_type, error.error_description))
|
||||
(error.error_type.value, error.error_description))
|
||||
return response
|
||||
|
||||
def resource(*urls, **kwargs):
|
||||
|
|
Reference in a new issue