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