我一直在尝试获取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