如何在刷新令牌中包括Firebase自定义声明?

时间:2020-07-25 17:26:05

标签: python firebase firebase-authentication claims-based-identity google-admin-sdk

我一直在尝试获取python Firebase中的自定义声明ID令牌的刷新令牌。但是,google API发送回的令牌省略了自定义声明。下面是我的代码。我已经验证了customToken输入是带有我的自定义声明的正确令牌:

def getRefreshToken(customToken):
    url = 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=%s' % config['apiKey']
    payload = {'token':customToken, 'returnSecureToken':True}
    res = flask.requests.post(url,json=payload)
    refresh_token = re.search('"refreshToken"\: "(.*)"',res.text).group(1)
    return refresh_token

0 个答案:

没有答案