Using DotNetOpenAuth AccessToken for uploading docx file to google
Posted
by PrashantC
on Stack Overflow
See other posts from Stack Overflow
or by PrashantC
Published on 2010-04-22T12:18:35Z
Indexed on
2010/04/22
12:23 UTC
Read the original article
Hit count: 257
dotnetopenauth
Hi , I am using DotNetOpenAuth Package, I am trying to upload a package to google docs,
Using client credentials i am able to do it successfully using following code,
DocumentEntry objDocumentEntry = new DocumentEntry();
objDocumentsService.setUserCredentials(strUserName,strPassWord);
string strAuthenticationToken =
objDocumentsService.QueryAuthenticationToken();
objDocumentEntry =
objDocumentsService.UploadDocument(Server.MapPath("test.docx"), "New
Name");
I want achieve save with plain oAuth, I am having following code written for it,
if (this.TokenManager != null)
{
if (!IsPostBack)
{
var google = new
WebConsumer(GoogleConsumer.ServiceDescription, this.TokenManager);
// Is Google calling back with authorization?
var accessTokenResponse =
google.ProcessUserAuthorization();
if (accessTokenResponse != null)
{
this.AccessToken =
accessTokenResponse.AccessToken;
}
else if (this.AccessToken == null)
{
// If we don't yet have access, immediately
request it.
GoogleConsumer.RequestAuthorization(google,
GoogleConsumer.Applications.DocumentsList);
}
}
}
I successfully get "AccessToken", But i am not sure how to use it.. Do we need to exchange this token? what excatly to do with this token? Is it a sessionToken?
Please provide some inputs, I am badly stuck with this problem from last 3 days,
Prashant C
© Stack Overflow or respective owner