我正在尝试使用OpenId将一个ASP.NET应用程序连接到Salesforce,目前这是我的连接代码。我认为除了redirect_uri参数,其他都已经搞定了,该参数必须与另一端的值完全匹配。
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 不是一个有效的参数。正确的设置方式是什么?
x.SignInScheme = "Cookies"
并删除x.AutomaticAuthenticate
。 - Tratcher