Created
February 25, 2018 20:39
-
-
Save hiranya911/2bc99d2b42365bf04c936a1e2ebdf558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firebase_admin import auth | |
import flask | |
app = flask.Flask(__name__) | |
@app.route('/api') | |
def backend_operation(): | |
id_token = flask.request.headers['X-Firebase-ID-Token'] | |
try: | |
# Check if the ID token is valid. Additionally, check if it was issued | |
# before the user's refresh tokens were revoked. | |
auth.verify_id_token(id_token, check_revoked=True) | |
except auth.AuthError as error: | |
return flask.jsonify({'error': str(error)}), 401 | |
return _do_operation(flask.requst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment