AuthConfig.cs
public static class AuthConfig
{
public static void RegisterAuth()
{
OAuthWebSecurity.RegisterLinkedInClient(
consumerKey: "xxxxxxxxxxx",
consumerSecret: "xxxxxxxxxx");
OAuthWebSecurity.RegisterFacebookClient(
appId: "xxxxxxxxxx",
appSecret: "xxxxxxxxxxxxxxxxxxxx");
}
}
账户 Controller ExternalLoginCallback方法
public class AccountController : Controller
{
[AllowAnonymous]
public ActionResult ExternalLoginCallback(string returnUrl)
{
AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl })); ;
}
}
我收到此错误:(401) 未经授权(每当我从 LinkedIn 登录时)。但是,如果是 facebook,它工作正常。请帮我解决一些问题。
最佳答案
这可以帮助您确定问题的根源
使用此 OAuth 测试控制台并将您生成的 header 与此工具生成的 header 进行比较: https://developer.linkedin.com/oauth-test-console 如果您的 header 错误,LinkedIn 将返回 401 状态
关于asp.net-mvc - 网络 MVC : LinkedIn The remote server returned an error: (401) Unauthorized,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23468319/