Fix bug accessing auth tokens
This commit is contained in:
parent
8c59707cba
commit
43ddf5b709
|
@ -160,7 +160,7 @@ def Authenticator(function):
|
||||||
return function(*args, **kwargs)
|
return function(*args, **kwargs)
|
||||||
# Key header-based authentication
|
# Key header-based authentication
|
||||||
if 'X-Api-Key' in flask.request.headers:
|
if 'X-Api-Key' in flask.request.headers:
|
||||||
if any(token for token in secret_tokens if flask.request.headers.get('X-Api-Key') == token):
|
if any(token for token in config['auth_tokens'] if flask.request.headers.get('X-Api-Key') == token.get('token')):
|
||||||
return function(*args, **kwargs)
|
return function(*args, **kwargs)
|
||||||
else:
|
else:
|
||||||
return {"message":"X-Api-Key Authentication failed"}, 401
|
return {"message":"X-Api-Key Authentication failed"}, 401
|
||||||
|
|
Loading…
Reference in New Issue