【发布时间】:2016-06-28 20:40:45
【问题描述】:
我正在尝试使用 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 不是要传递的有效参数。正确的设置方法是什么?
【问题讨论】:
-
对于 OIDC,添加
x.SignInScheme = "Cookies"并删除x.AutomaticAuthenticate。
标签: asp.net-core openid-connect