【发布时间】:2020-10-30 17:09:16
【问题描述】:
我正在将我们的代码从 .NET Framework 升级到 .NET Core 3.1,但在我们处理 Salesforce API 身份验证的服务中遇到了问题。
Salesforce 令牌端点返回错误
错误请求:{"error":"invalid_grant","error_description":"authentication failure"}
当我在 .NET Core 中运行我的代码时。当我使用完整的框架时,它工作得很好。
_tokenClient = factory.CreateClient("TokenClient");
_tokenClient.BaseAddress = new Uri(_options.TokenUrl);
HttpContent content = new FormUrlEncodedContent(new Dictionary<string, string>
{
{"grant_type", "password"},
{"client_id", _options.ClientId},
{"client_secret", _options.ClientSecret},
{"username", _options.Username},
{"password", _options.Password},
});
var response = await _tokenClient.PostAsync("token", content);
【问题讨论】:
标签: c# .net .net-core salesforce