Search code examples
asp.netdotnetopenauthgoogle-openidopenid-connect

Upgrading OAuth2/OpenID2 to OpenID Connect


I'm using DotNetOpenAuth library for managing authentication. Now google has decided to not support anymore OpenId2, I've read the documentation but I haven't understood very well how I can migrate to OpenId Connect.

Now I'm authenticating with google sending the following request:

        using(OpenIdRelyingParty openid = new OpenIdRelyingParty())
        {
            string googleEndPoint = "https://www.google.com/accounts/o8/id";
            IAuthenticationRequest request = openid.CreateRequest(Identifier.Parse(googleEndPoint));
            ...

So I'm wondering if I have to modify only openid.CreateRequest(Identifier.Parse(googleEndPoint)) to include REALM and Return URI to make it work.

I'm looking for example on internet about Google auth with DotNetOpenAuth lib but I haven't found anything


Solution

  • I ran into the same issue. For migrating to OIDC Google recommends to use the "HD" parameter, see details here: https://developers.google.com/accounts/docs/OpenID#openid-connect

    I recently created a lightweight implementation of authentication against Google OIDC and made this library open source. The code is pretty basic and gets the job done:

    http://www.dominikamon.com/articles/3091/oidc-lightweight-library-for-aspnet.html

    The new API works different if you want to access information such as firstname, lastname, gender. You need to get this information from Google+. Therefore you need need to setup the Google+ API (You can send up to 10000 requests per day for free)

    Hope this helps.