我如何使用 Zoho SDK 验证我的基于服务器的应用程序?

How do I authenticate my server based app with Zoho SDK?

我希望这是有道理的。我正在使用 Zoho C# SDK 示例将记录写入 CRM 线索。在调用 recordOperations.CreateRecords() 时;尝试从令牌商店获取令牌后失败。 这是我保存的代币

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 并且我已经将它硬编码为 return 正是上面令牌对象中的内容。 CreateRecords 为“invalid_code”抛出错误。这是日志文件中的内容

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}

它尝试刷新令牌时似乎失败了,所以我假设我没有在令牌对象中发送正确的信息?

*** 为@sucasa 编辑 *** 这就是我发送到 Initialize 方法中的内容。

自从我的第一个 post 以来我发现的是,我没有从 Initialize 获得初始 token 并且它没有调用我创建的自定义 TokenStore.SaveToken() 并且它应该, 正确的?如果我保存它,我所拥有的只是上面的内容,而不是实际的token。所以我想当我去创建潜在客户时,我实际上并没有要刷新的初始令牌。我希望这更清楚。

访问令牌过期,必须使用刷新令牌进行刷新。错误消息表明了这一点。您可以记录 token 的值并在此处报告吗?