0

yahoo error msg我收到此错误 401 禁止 - 我没有通过 yahoo 的 oauth 获得许可。我已经更新了与我的开发者帐户完美匹配的密钥和秘密。我不确定我是否忽略了雅虎设置的某些内容。

if (!isWeb) return;

// Only web uses external authentication.
var yhOptions = new YahooAuthenticationOptions
{
    ConsumerKey = ConfigurationManager.AppSettings["YahooId"],
    ConsumerSecret = ConfigurationManager.AppSettings["YahooSecret"],

    Provider = new YahooAuthenticationProvider()
    {
        OnAuthenticated = (context) =>
        {
            foreach (var claim in context.User)
            {
                var claimType = string.Format("urn:yahoo:{0}", claim.Key);
                var claimValue = claim.Value.ToString();
                if (!context.Identity.HasClaim(claimType, claimValue))
                    context.Identity.AddClaim(new System.Security.Claims.Claim(claimType, claimValue,
                        "XmlSchemaString", "Yahoo"));
            }

            return Task.FromResult(0);
        }
    }
}

app.UseYahooAuthentication(yhOptions);
4

0 回答 0