I want to allow User to login using Gmail
. So, I googled and got many samples but all were using OpenID and as I have checked Google Documentation, they have stopped new domain registration for OpenID and from now, Developer will need to use OAuth API.
I have registered my Project and got Secrey KEY & Client ID. Now I want to integrate it my Project but I am unable to find any sample working Project.
Please help me regarding this. I am not using MVC.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Based on Google lastest API for DotNet I have used below code which works for Console App, Web Form and Asp.Net MVC as well.
Here ClientId and ClientSecret stored in web.config file which can be modified later easily if requires.
I am explaining based on Google+ API, which uses Gmail ID to login. So, you will be authenticating your users to login with Gmail.
1: You need to turn on the
Google+ API
:2: Once you turned on the Google+ API, then you need to add new
Client ID
.Here in Step 2, when you add Redirect URL, you will need to add the URL of your website on which page you want user to redirected to.
Once you have created your Client ID for Web Application.
Then in your application, you need to add two packages
Now add this namespaces;
Now in code first your declare this variables at top of your page;
Then in you Page Load event;
Now the event that will call the google API
Add this
GooglePlusAccessToken
class;Also you can call other
oauth API
with theAccess Token
to retrieve some of users information.Hope this is what you were looking for, I implemented this and it is working just fine. Hope this helps.