OussamaOBO / gshoppingcontent-php

Automatically exported from code.google.com/p/gshoppingcontent-php
Other
0 stars 0 forks source link

Authorizing with OAuth2 #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi, 

What steps will reproduce the problem?

1.

Here's a small bit of code: 

$authToken = new GSC_OAuth2Token(CLIENT_ID, CLIENT_SECRET, MY_USER_AGENT);

$authorizeUrl = $authToken->generateAuthorizeUrl(APPLICATION_REDIRECT_URI);

//echo 'Please visit: ' . $authorizeUrl ;

/* sample output for $authorizeUrl 

https://accounts.google.com/o/oauth2/auth?
response_type=code&
client_id=xxxxx.apps.googleusercontent.com&
redirect_uri=https%3A%2F%2Fexample.com%2Foauth2callback&
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fstructuredcontent&
approval_prompt=auto&
access_type=offline

*/

visitUrl($authorizeUrl); 

The above visitUrl function is basically using the php header function to 
navigate to the url. I can confirm that the authorizeUrl is generated correctly 
and I can print and put in my browser. When I do that, I get a prompt to allow 
access and after access is granted I get redirected to the callback url I have 
specified. 

What I need help with is that when I do the same thing in code i.e. visitUrl 
hangs and does not return. My guess is it operating in interactive mode. 
Obviously I am doing something wrong and would appreciate any kind suggestions. 

What version of the product are you using? On what operating system?

Version 1.3 on RHEL 6. 

Thanks a lot, 

-Reuben

Original issue reported on code.google.com by reuben.n...@gmail.com on 29 Oct 2012 at 8:04

GoogleCodeExporter commented 8 years ago
The library maintainers (I am an ex-maintainer) aren't PHP wizards, and this 
question doesn't seem to be an issue with the library, but an issue with your 
PHP code calling it/interacting with it. I would bet that the folks on 
StackOverflow would have some good insights, so it may be helpful to ask this 
there.

Original comment by dhermes@google.com on 29 Oct 2012 at 8:11

GoogleCodeExporter commented 8 years ago
Thank you for your response. I will try asking elsewhere. FYI, I was following 
an official google tutorial here 
https://developers.google.com/shopping-content/developers-guide-php which was 
using this api and hence the reason I asked the question here.

Thanks again. 

-Reuben 

Original comment by reuben.n...@gmail.com on 29 Oct 2012 at 9:05

GoogleCodeExporter commented 8 years ago
check if you updated your Client ID and Client Secret and UPLOADED the file on 
your server.

Original comment by Hedi.Lassoued@digito.ca on 19 Mar 2013 at 2:18