Asp.net identity Google account id migration from openId to oauth

▼魔方 西西 提交于 2019-12-03 21:05:40

To change the authentication request to include the openid.realm parameter, you can use the OnApplyRedirect delegate e.g.

app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions()
{
    ClientId = "",
    ClientSecret = "",
    Provider = new GoogleOAuth2AuthenticationProvider
    {
        OnApplyRedirect = context =>
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>()
            {
                { "openid.realm", "http://mywebsite.com/openid/realm" }
            };
            var redirectUri = WebUtilities.AddQueryString(context.RedirectUri, dictionary);
            context.Response.Redirect(redirectUri);
        },
    }
});

The value of openid.realm needs to be the realm you used for OpenID 2.0

The google migration doc has information on how to map from the users old id to the new one

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!