How to use OpenID without asking the user for its OpenID URL?

I am creating an OpenID provider using DotNetOpenAuth and I am stuck.

It seems that OpenID requires that the user first provide their OpenID URL, and then the consumer redirects it to the provider, specifying the URL as a parameter (checkid_setup mode).

But with Google and some other providers, it works differently. You are simply redirected to the general page on which you must log in or select one of the accounts with which you are already logged in. Or simply redirected back if you are logged in with a single account.

How does this relate to checkid_immediate mode? If so, give me a link to an article explaining how this works.

+4
source share
1 answer

The difference in behavior that you see is orthogonal to the checkid_setup and checkid_immediate modes that you notice.

If the user enters their own OpenID, which is called an Authenticated Identifier. If instead the user simply presses (or dials) their provider (for example, Google in your example), which is called the OP identifier.

For example, if you enter https://www.google.com/accounts/o8/id in the OpenID field, you will see the behavior that you describe, since Google will help the user to enter your website, no matter who it is.

So, at this point you have several options:

  • If your site is based on ASP.NET web forms, you can use the OpenIdButton control by entering the https://www.google.com/accounts/o8/id identifier in the corresponding property, and the user can click this button to simply register using your google account.

  • If you use MVC (or use web forms, but want to do it programmatically), you can call OpenIdRelyingParty.CreateRequest("https://www.google.com/accounts/o8/id") and redirect the user with the result to Google .

In any case, if the user is already registered with Google, they will not need to log in to Google. And if the user has already told Google that they approve of entering your website, they will not see Google at all during this login process.

+4
source

Source: https://habr.com/ru/post/1391385/


All Articles