2
我试图使用OpenId将ASP.NET应用程序连接到Salesforce,目前这是我迄今为止的连接代码。我想我得到了除redirect_uri参数外的所有内容,它必须完全匹配另一端的值。如何在ASP.NET Core的OpenIdConnectOptions上设置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不是一个有效的参数传递。什么是正确的方式来设置它?
对于OIDC,添加'x.SignInScheme =“Cookie”'并移除'x.AutomaticAuthenticate'。 – Tratcher