verify token fix 4

This commit is contained in:
Łukasz Jędyk 2022-01-31 19:10:21 +01:00
parent 77c4fc49d9
commit 708e241ea1
2 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,7 @@ def create_app():
twitter_db.drop_all(app=app)
twitter_db.create_all(app=app)
twitter_db.drop_all(app=app)
campaign_db.drop_all(app=app)
campaign_db.create_all(app=app)
app.register_blueprint(twitter, url_prefix='/twitter')

View File

@ -8,6 +8,9 @@ AUDIENCE = os.environ.get('GOOGLE_CLOUD_PROJECT')
def verify_token(headers):
id_token = headers['Authorization'].split(' ').pop()
claims = google.oauth2.id_token.verify_firebase_token(id_token, HTTP_REQUEST, audience=AUDIENCE)
try:
claims = google.oauth2.id_token.verify_firebase_token(id_token, HTTP_REQUEST, audience=AUDIENCE)
except:
return None
return claims