开发者

Using DotNetOpenAuth AccessToken for uploading docx file to google

开发者 https://www.devze.com 2022-12-28 00:02 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号