如何在asp.net 4.0中将open id 2.0迁移到Open Id connect

时间:2015-05-20 09:54:40

标签: asp.net openid dotnetopenauth openid-connect

我正在使用以下代码实施Google Open ID身份验证:

        string discoveryUri = "https://www.google.com/accounts/o8/id";
        var b = new UriBuilder(Request.Url) { Query = "" };
        var req = openid.CreateRequest(discoveryUri, b.Uri, b.Uri);
        var fetchRequest = new FetchRequest();
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.First);
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.Name.Last);
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.Person.Gender);
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.Contact.Phone.Mobile);
        fetchRequest.Attributes.AddRequired(WellKnownAttributes.BirthDate.WholeBirthDate);
        req.AddExtension(fetchRequest);
        req.RedirectToProvider();

我们尝试过这个解决方案: Google OpenId Connect migration: getting the openid_id in ASP.NET app

但收到此例外:

  

Microsoft.Owin.Security.Google.dll中发生了'System.ArgumentNullException'类型的异常,但未在用户代码中处理

请为解决这些问题提出最佳答案。

0 个答案:

没有答案