我正在验证用户帐户并将详细信息写入json文件中以连接到云。如何获取刷新令牌
下面是我的代码,该代码执行身份验证并将详细信息存储在json
try:
with open(file, 'r') as infile:
creds = json.load(infile)
except FileNotFoundError:
return ''
except json.decoder.JSONDecodeError:
return ''
credentials = google.oauth2.credentials.Credentials(
'access_token',
refresh_token=creds['refresh_token'],
token_uri=creds['token_uri'],
client_id=creds['client_id'],
client_secret=creds['client_secret'],
scopes=creds['scopes'])
refresh_token = creds['refresh_token']
print(refresh_token)
return credentials
我的刷新令牌为空
{"refresh_token": null,
"token_uri": "https://oauth2.googleapis.com/token",
"client_id": "13465789222-
tmd611m4j6ofdpsvp25t59s2gf6im4ed.apps.googleusercontent.com",
"client_secret": "HCdEIght0997j5iL2ewi2vUnM-",
"scopes": ["https://www.googleapis.com/auth/cloud-platform"]}