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

Passing oAuth 2.0 access token for Service account to Shopping API #243

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Which Google API and version (e.g. Google Tasks API version 1)?

Search API for Shopping

What should the sample demonstrate (e.g. using OAuth2, using a specific
feature of that API)?

I am using service account to access the API and using JWT, i am able to get 
the proper access token from response which looks like this 

{   "access_token" : "1/7W36mBpayy_X0rDB12lQ9cwGKL-psD-ySFZQawmQmM4",   
"token_type" : "Bearer",   "expires_in" : 3600 }

Seems like response is proper and the access token from this response will be 
"1/7W36mBpayy_X0rDB12lQ9cwGKL-psD-ySFZQawmQmM4"

Now the issue is how do i pass this access token to the api so that it will 
authenticate me? I have tried a couple of different methods to do so but it is 
just not working. 

FIRST 

ShoppingService Service = new ShoppingService { Key = "<API ACCESS KEY FOR 
SERVER APPS>" };
var Request = Service.Products.List("gan:XXXXXX");
Request.Oauth_token = "<Access_token HERE>";
...........................

SECOND 

ShoppingService Service = new ShoppingService();
var Request = Service.Products.List("gan:XXXXXX");
Request.Oauth_token = "<Access_token HERE>";

In both cases i am getting the same 412 error.

Platform (e.g. Windows, Mono, Silverlight, WP7)?
windows 64 bit & asp.net 4.0

Please provide any additional information below.

I just need an example that will show me how to pass this token in a proper way 
and authenticate myself. I am really stuck without this and will not be able to 
release my project without getting this done.

Original issue reported on code.google.com by dhaivat....@gmail.com on 24 Aug 2012 at 9:28

GoogleCodeExporter commented 9 years ago
We are working on adding a service account sample to the library, please bear 
with us a bit more

Original comment by ccherub...@google.com on 24 Aug 2012 at 9:35

GoogleCodeExporter commented 9 years ago
FYI, support for service accounts has just been added, the sample will be added 
as soon as possible

Original comment by ccherub...@google.com on 24 Aug 2012 at 9:47

GoogleCodeExporter commented 9 years ago
Thanks, any ETA on adding sample?
I am asking so that i can plan ahead. Other features of my project are already 
released. This is becoming a bottleneck for us.

Original comment by dhaivat....@gmail.com on 24 Aug 2012 at 10:29

GoogleCodeExporter commented 9 years ago
Sorry, I have no ETA for that

Original comment by ccherub...@google.com on 24 Aug 2012 at 10:30

GoogleCodeExporter commented 9 years ago
can you atleast point me as to where should i pass this access token or what am 
i doing wrong here? 
Any help from you will be much much appreciated.

Original comment by dhaivat....@gmail.com on 30 Aug 2012 at 3:02

GoogleCodeExporter commented 9 years ago
I'm having the exact same issue as described here.  I get the exact same 
results. Has there been any updates?  I'm also not finding any sample projects. 
 Its close to six months ago that this issue was reported, has an ETA on the 
samples been announced?  Can someone point me in the right direction?  Any help 
is appreciated.

Original comment by robertws...@gmail.com on 13 Feb 2013 at 5:23

GoogleCodeExporter commented 9 years ago
First of all sorry for the big delay.
A sample for service account (using Plus API) was added to our samples 
repository a couple of weeks ago. You can find it in the following link:
https://code.google.com/p/google-api-dotnet-client/source/browse/?repo=samples#h
g%2FPlus.ServiceAccount

I'm closing this issue now, please let me know if something is missing. 

Original comment by pele...@google.com on 25 Feb 2013 at 12:02