Click here to Skip to main content
13,140,231 members (46,179 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I need to get user profile details from gmail using OAuth for that am using DotNetOpenAuth.dll for OAuth authentication from gmail , its hitting the google login for authentication and redirect to my site correctly but I don't know how to catch that access token.

For Reference here is the link

OAuth 2.0 with Gmail over IMAP for web applications[^].

If anybody having some other ideas please help me am waiting.
If anybody having sample for that it will more helpful.

Thank you
Posted 13-Dec-12 1:24am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you go through the link you have provided, the solution is there itself.
It says like below...

After this step user is redirected back to your website ( Following is this callback code. Its purpose is to get a refresh-token and an access-token:
WebServerClient consumer= new WebServerClient(server, clientID, clientSecret);
consumer.ClientCredentialApplicator =
IAuthorizationState grantedAccess = consumer.ProcessUserAuthorization(null);
string accessToken = grantedAccess.AccessToken;

An access token is usually valid for a maximum of one hour, and allows you to access the user’s data. You also received a refresh token. A refresh token can be used to request a new access token once the previous expired.
Sample Project links -
Refer dotnetopenid / samples / OAuthConsumer / GoogleAddressBook.aspx.cs[^] for sample page and dotnetopenid / samples / OAuthConsumer[^] for full project.
arunraju 14-Dec-12 6:13am
I need Some sample code for that ,
Tadit Dash 14-Dec-12 6:36am
I have added two sample project links.
Check them out please.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 14 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100