FetchData using DotNetOpenAuth?

I implemented this simple code as described here (vs 2010, webforms)

protected void Page_Load(object sender, EventArgs e)
{
  var openid = new OpenIdRelyingParty();
  var response = openid.GetResponse();

  if (response != null && response.Status == AuthenticationStatus.Authenticated)
  {
    FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false);
  }
}

Click:

protected void btnGoogle_Click(object sender, ImageClickEventArgs e)
{
  using (OpenIdRelyingParty openid = new OpenIdRelyingParty())
  {
    var request = openid.CreateRequest("https://www.google.com/accounts/o8/id");
    request.RedirectToProvider();
  }
}

Question number 1

When I click login (via google), it opens this consent screen :

enter image description here

But how did it happen? I thought I needed to create an API key in the Google Developer Console so that users could log in. (as I did here with another myne application →)

enter image description here

Obviously, I did not create the application " localhost". so how does it work? (again this is a demo that I downloaded from the Internet).

Question number 2

As soon as I get the result :

enter image description here

How can I get user data? (e.g. email address) {article not mentioned}

nb DotNetOpenAuth ver 3.4.6.10357

+4
1

, openId, OAuth2. Open id - Oauth2.

:

: Google OpenID 2.0 . OpenID 2.0, endpoint OAuth 2.0 ( ), , .

OpenId 20 2015 ., .

, , , Oauth2, oauth2 .

API Google : Google Oauth2 #

0

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


All Articles