-3

I try this:

var auth = new AuthorizationCodeMvcApp(controller, 
                                       new FlowMetaDataCalendarV3())
           .AuthorizeAsync(CancellationToken.None).Result;

AuthorizationCodeMvcApp execute fine, but AuthorizeAsync throw a exception in NewtonSoft.Json:

[NewtonSoft.Json.JsonreaderException] --> {"Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 72."}

I currently installed:
Google.Apis.Auth vrs 1.9.0
Google.Apis.Auth.MVC 1.9.0
NewtonSoft.Json 6.0.4

How to resolve this??

crthompson
  • 15,653
  • 6
  • 58
  • 80
  • Can you please attach the HTTP request and response (using Fiddler or some other tool that exposes the real HTTP traffic). Did you follow our documentation at https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web_applications? By the way, try to use the async version as suggested in the documentation. – peleyal Dec 23 '14 at 13:43
  • Yes i follow that documentation. But when try to use await, get a compilation error, because the method AuthorizeAsync dont have the async identifier. I think that is not the source of the problem. – amedriveroperez Dec 23 '14 at 17:08
  • What was the compile error? Can you attach Fiddller output? – peleyal Dec 23 '14 at 17:21
  • Compilation Error: -------- Cannot await Google.Apis.Auth.OAuth2.Web.AuthorizationCodeWebApp.AuthResult --------- The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. – amedriveroperez Dec 23 '14 at 17:52
  • Fiddler:--- Host: 28.client-channel.google.com Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 X-Origin: https://talkgadget.google.com X-Goog-AuthUser: 1 Authorization: SAPISIDHASH 1419355182857_132464e1553d544879da3439cbb372b41fb98977 Accept: */* X-Client-Data: CJa2yQEIpbbJAQiptskBCMS2yQEInobKAQjviMoB – amedriveroperez Dec 23 '14 at 17:55
  • You didn't declare the method to be async: "public async Task IndexAsync(CancellationToken cancellationToken)" – peleyal Dec 23 '14 at 18:18

1 Answers1

1

Try using JArray.Parse() in stead of JObject.

Shiva
  • 20,575
  • 14
  • 82
  • 112
Aaron
  • 1,361
  • 1
  • 13
  • 30