我正在尝试将客户端提供的auth_code转换为后端的令牌。 (正面和背面是两个不同的发球区。)
scope='https://www.googleapis.com/auth/calendar' code='code=4/nQCEBlo_YbWfOw1NXCWJ3UCyRzPT*****NJbda0eaXdmv032qX2PZhV4Cd2YzO3sPQ36*************' # Exchange auth code for access token, refresh token, and ID token c = client.credentials_from_code('***ClientID*****-*****************.apps.googleusercontent.com' ,'SECRET*********',scope,code) print (c.id_token)
另一种尝试是:
CLIENT_SECRET_FILE = 'client_secret.json'
credentials = client.credentials_from_clientsecrets_and_code(
CLIENT_SECRET_FILE,
['https://www.googleapis.com/auth/calendar'],
'code=4/nQCEBlo_YbWfOw1NXC****************4Cd2Y*********mGgA')
我收到此错误:
raise FlowExchangeError(error_msg)
oauth2client.client.FlowExchangeError: invalid_grantMalformed auth code.
有什么主意吗? 谢谢!