abujehad139 / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

Tasks.ASP.NET.SimpleOAuth2 sample returns a 403 error #214

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I'd like to use the Google Calendar API for an ASP.NET project so I've 
downloaded the ASP.NET samples for the Google API v3 to get me started and 
launched the Tasks.ASP.NET.SimpleOAuth2 sample app, configured what's required 
in the ClientCredentials.cs, set the 'localhost' binding to my web app and set 
'http://localhost/default.aspx' in the list of redirect urls in the API Access 
Panel. 

I can authenticate, choose a Google Account, authorize the API Project to 
access my data and when I want to fetch the data from the Tasks list I get this 
error

The request 'Google.Apis.Requests.Request(list @ 
https://www.googleapis.com/tasks/v1/users/@me/lists?alt=json&prettyPrint=true)' 
has failed. The service tasks has thrown an exception: 
Google.GoogleApiRequestException: Google.Apis.Requests.RequestError
Access Not Configured [403]
Errors [
Message[Access Not Configured] Location[ - ] Reason[accessNotConfigured] 
Domain[usageLimits]
]
---> System.Net.WebException: The remote server returned an error: (403) 
Forbidden.
  at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
  at Google.Apis.Requests.Request.InternalEndExecuteRequest(IAsyncResult asyncResult) in c:\googlecode\google-api-dotnet-client\5-4-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 326
  --- End of inner exception stack trace ---
  at Google.Apis.Requests.Request.AsyncRequestResult.GetResponse() in c:\googlecode\google-api-dotnet-client\5-4-2012\default\Src\GoogleApis\Apis\Requests\Request.cs:line 300
  at Google.Apis.Requests.ServiceRequest`1.GetResponse() in c:\googlecode\google-api-dotnet-client\5-4-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 183
  at Google.Apis.Requests.ServiceRequest`1.Fetch() in c:\googlecode\google-api-dotnet-client\5-4-2012\default\Src\GoogleApis\Apis\Requests\ServiceRequest.cs:line 203
  at Tasks.ASP.NET.SimpleOAuth2._Default.FetchTaskslists() in C:\Users\nb\Dropbox\google api sample\Tasks.ASP.NET.SimpleOAuth2\Default.aspx.cs:line 116

Could somebody help me ? 

Regards,
Nicolas

Original issue reported on code.google.com by panzerkunst on 5 Jun 2012 at 7:59

GoogleCodeExporter commented 9 years ago
You need to enable the Google Calendar API in the API's Console for your client 
ID and secret. See here: https://code.google.com/apis/console

Original comment by asky...@google.com on 5 Jun 2012 at 9:30

GoogleCodeExporter commented 9 years ago
Sorry, I forgot to mention that I did that also :)

Original comment by panzerkunst on 6 Jun 2012 at 4:45

GoogleCodeExporter commented 9 years ago
Please re-open the issue

Original comment by panzerkunst on 6 Jun 2012 at 4:46

GoogleCodeExporter commented 9 years ago
Can you access the API using the APIs explorer?

https://developers.google.com/apis-explorer/#p/calendar/v3/

Original comment by asky...@google.com on 6 Jun 2012 at 5:10

GoogleCodeExporter commented 9 years ago
Hi,

I'm currently testing the sample with the Tasks API, so I made a test request 
using API Explorer 
(https://developers.google.com/apis-explorer/#p/tasks/v1/tasks.tasklists.list) 
and that returned a valid reponse. 

I've also tested the calendar API using the API explorer and succeeding in 
creating an event in my calendar. 

Thx,
Nicolas

Original comment by panzerkunst on 6 Jun 2012 at 6:43

GoogleCodeExporter commented 9 years ago
Erm... Sorry, I've just realized I was wrong from the beginning. The Calendar 
API was enabled - but NOT the Tasks API (which is the one I was using in the 
sample). My bad -_- 

Sorry for disturbing you, but thanks for the help !!

Nicolas

Original comment by panzerkunst on 7 Jun 2012 at 6:02