import urllib.request, urllib.parse, urllib.error, json
from jose import jwt
idtoken = '<id token passed to server from firebase auth>'
target_audience = '<firebase app id>'
certificate_url = (
    """https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com"""
    )
response = urllib.request.urlopen(certificate_url)
certs = response.read()
certs = json.loads(certs)
user = jwt.decode(idtoken, certs, algorithms='RS256', audience=target_audience)
print(user)
How to decode Firebase JWT token in Python