我正在尝试使用OpenId将ASP.NET应用程序连接到Salesforce,目前这是我的连接代码到目前为止.我想除了redirect_uri参数之外我得到了所有东西,它必须与另一端的值完全匹配. app.UseCookieAuthentica
app.UseCookieAuthentication(x =>
{
x.AutomaticAuthenticate = true;
x.CookieName = "MyApp";
x.CookieSecure = CookieSecureOption.Always;
x.AuthenticationScheme = "Cookies";
});
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap = new Dictionary<string, string>();
app.UseOpenIdConnectAuthentication(x =>
{
x.AutomaticAuthenticate = true;
x.Authority = "https://login.salesforce.com";
x.ClientId = "CLIENT_ID_HERE";
x.ResponseType = "code";
x.AuthenticationScheme = "oidc";
x.CallbackPath = new PathString("/services/oauth2/success");
//x.RedirectUri = "https://login.salesforce.com/services/oauth2/success";
x.Scope.Add("openid");
x.Scope.Add("profile");
x.Scope.Add("email");
});
但是RedirectUri不是要传递的有效参数.设置它的正确方法是什么?
使用从当前请求和您指定的CallbackPath中提取的方案,主机,端口和路径自动为您计算redirect_uri.x.RedirectUri =“https://login.salesforce.com/services/oauth2/success”看起来非常可疑(除非您为Salesforce工作):不要忘记它是用户代理在身份验证时重定向到的回调URL流程完成,而不是您的身份提供商的授权端点.
因此,在您的情况下,用户将被重定向到http:syourdomain.com/services/oauth2/success.它是您在Salesforce选项中注册的地址吗?
