I develop an ASP.NET WebForms application and I need that if the user has been authenticated in the browser with a Google account, they can access the page, otherwise not.
I develop an ASP.NET WebForms application and I need that if the user has been authenticated in the browser with a Google account, they can access the page, otherwise not.
You can use google credentials in your application, but you must specifically implement the login requesting the credentials, there is no automatic auto-login.
you will have to use
OAuth
OAuth for ASP.NET Google
Google API Client Libraries OAuth 2.0
As you will see, you require the call to an api that uses a
Client ID
to authorize the authentication and returns a token that you will use in your development.It may be that if another application has already authenticated previously, the credential data is persisted and the new authentication is something direct, but you still need to implement the OAuth infrastructure and make the call.
Strictly what you ask I don't think it can be done.
Google is pretty strict with its security policy so you can't just grab browser authentication to use in your app. That would give you access, for example, to the user's email address, which is terminally prohibited by Google. (counterexample, your app could be an email grabber without users knowing it)
What you can do is log into your application with the google account, but the user must accept the strict permissions of what you are using in the application.
To do this you must use the OAuth 2.0 protocol to log in. You have more information on the official google page: https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth
If you have doubts about how to use OAuth you should ask a new question since it will have nothing to do with this one.