Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login to ASP.net application via Google account

My client has a request that he wants to login to ASP.net web application via Google account. As I have never done something like that I have some concerns.

What bothers me is that he wants to add roles (administrator, user) to specific accounts and this puzzles me because I'm not sure how to connect Google account data with my database. I assume that I won't be able to get the password or username that I could store to my own database.

Where to start?

like image 520
wegelagerer Avatar asked Dec 28 '12 14:12

wegelagerer


3 Answers

Use OpenID. This is implemented in ASP.NET in the DotNetOpenAuth library. It includes samples for Google logins, and it's very easy.

The roles should work to. As you build up your user table, just add users to the appropriate roles.

like image 113
Andrew Arnott Avatar answered Oct 14 '22 04:10

Andrew Arnott


Have a look at this:

http://www.asp.net/vnext/overview/aspnet/oauth-in-the-default-aspnet-45-templates

Scott Hanselman giving a quick overview of the OpenID features in .NET4.5. This might be a good starting point for you.

On MSDN: http://blogs.msdn.com/b/webdev/archive/2012/08/15/oauth-openid-support-for-webforms-mvc-and-webpages.aspx

like image 35
Greg Smith Avatar answered Oct 14 '22 04:10

Greg Smith


I suggest you to take a look at this codeplex miniproject : http://loginwithgoogle.codeplex.com/. You might find it helpful.

Regards

like image 31
alcatraz Avatar answered Oct 14 '22 05:10

alcatraz