我希望这是有意义的。我正在使用Zoho客户关系管理软件开发工具包的例子来写记录到C#的领导。在调用recordOperations.CreateRecords()时;在尝试从令牌存储区执行GetToken后失败。这是我要保存的令牌
Token token = new OAuthToken(
"xxxx.clientid.goes.here.xxxxx",
"xxxx.clientsecret.goes.here.xxxx",
"REFRESH/GRANT token",
TokenType.GRANT,
string.Empty);
TokenStore tokenStore = new CustomTokenStore();
tokenStore.SaveToken(user, token); 我正在将这个令牌发送到SDKInitilizer.Initialize中。此时没有错误。接下来,我尝试创建一个潜在客户。当它进入recordOperations.CreateRecords()内部时,它会尝试GetToken,而我已经对它进行了硬编码,以准确地返回上面的token对象中的内容。对于"invalid_code“,CreateRecords抛出一个错误。以下是日志文件中的内容
21-09-07 16:49:34 [INFO]: Initialization successful for Email Id : myemail@email.com in Environment : https://www.zohoapis.com.
21-09-07 16:49:47 [INFO]: Access Token has expired. Hence refreshing.
21-09-07 16:49:50 [ERROR]: Exception in authenticating current request : {"Code":"INVALID CLIENT ERROR","Message":"invalid_code","Cause":null,"Details":null,"StackTrace":" at Com.Zoho.API.Authenticator.OAuthToken.ParseResponse(String response)\r\n at Com.Zoho.API.Authenticator.OAuthToken.RefreshAccessToken(UserSignature user, TokenStore store)\r\n at Com.Zoho.API.Authenticator.OAuthToken.Authenticate(APIHTTPConnector urlConnection)\r\n at Com.Zoho.Crm.API.Util.CommonAPIHandler.APICall[T](Type className, String encodeType)","Data":{},"InnerException":null,"HelpLink":null,"Source":"ZCRMSDK","HResult":-2146233088}当它尝试刷新令牌时似乎失败了,所以我假设我没有在令牌对象中发送正确的信息?
* Edit for @sucasa *这是我发送到Initialize方法中的内容。

从我的第一篇文章开始,我就明白了,我没有从Initialize得到初始的token,它也没有调用我创建的自定义TokenStore.SaveToken(),它应该调用的,对吧?如果我保存它,我得到的只是上面的内容,而不是一个实际的token。因此,我认为当我创建销售线索时,实际上并没有要刷新的初始令牌。我希望这是更清楚的。
发布于 2021-09-10 05:15:30
访问令牌过期,必须使用刷新令牌进行刷新。错误消息指出了这一点。您可以记录token的值并在此返回报告吗?
https://stackoverflow.com/questions/69105907
复制相似问题