OAUTH2 setup | localhost / production

1,865 views
Skip to first unread message

Rocky Jaiswal

unread,
Aug 4, 2014, 5:04:37 AM8/4/14
to adwor...@googlegroups.com
Hi All,

To minimize the hits on Adwords we create an OAuth2 API so one service is responsible for fetching / refreshing the tokens and all other apps get the tokens from this single app. Lately, we have been seeing this issue that when we first try and authorize a new account we do not get a redirect URL back (for the consent popup) on the production server, however when I do the same thing on localhost it works as expected. 

Is this something to do with OAUTH2 setup, I can confirm that both our URLs (localhost and production) are configured for OAUTH access so I cannot see why this is happening.

Any help will be appreciated on this.


Thanks,
Rocky


Danial Klimkin

unread,
Aug 4, 2014, 5:21:30 AM8/4/14
to adwor...@googlegroups.com
Hello Rocky,


Could you please describe the issue in more details? What are exact steps for both prod and test setups?

Do you use web application or offline OAuth2 client?


-Danial, AdWords API Team.

Rocky Jaiswal

unread,
Aug 4, 2014, 5:38:52 AM8/4/14
to adwor...@googlegroups.com
Thanks Danial.

We have the setup for OAUTH as - 


Client ID for web application


I have configured this on https://console.developers.google.com/

we have multiple URLs configured as Redirect URIs and JS origins for dev, testing and production.

Now, lets say we want to add a new adwords account into our token server. We will first need to authorize it, and we should get a redirect URL from Google so that the user can confirm that.

On production lets say https://abc.example.com I do not get a redirect URI back however if I do the same action on http://localhost:3000 it works. Both the URIs are configured on the developer console and the account has not given us any permissions already (so I should get a redirect url back not anything else).

So I am lost at why this is happening.

Thanks,
Rocky

Danial Klimkin

unread,
Aug 4, 2014, 9:32:57 AM8/4/14
to adwor...@googlegroups.com
Hello Rocky,


The authorization URL is a known value and generally generated on the client side (e.g. by our libraries). Is it the one you are missing?


-Danial, AdWords API Team.

Rocky Jaiswal

unread,
Aug 4, 2014, 9:44:23 AM8/4/14
to adwor...@googlegroups.com
Hi Danial,

Yes, so since the code is same locally and on server, the client lib is also sending the same request but I see different responses from Google locally and on server -

sample code -

adwords_client.authorize({oauth2_callback: "some_server_url"})

this returns back a redirect URL for localhost but a blank token hash on the prod servers.


Thanks,
Rocky

Danial Klimkin

unread,
Aug 4, 2014, 11:08:02 AM8/4/14
to adwor...@googlegroups.com
Hello Rocky,


Can you send me exact URLs produced in both cases, and exact server responses?

Please send that only to me directly ("reply to author" on the right).


-Danial, AdWords API Team.

Rocky Jaiswal

unread,
Aug 4, 2014, 11:32:58 AM8/4/14
to adwor...@googlegroups.com
Hi Danial,

Sent a private reply, hope you got it (I was slightly confused by the interface).

Thanks,
Rocky

Rocky Jaiswal

unread,
Aug 4, 2014, 12:51:41 PM8/4/14
to adwor...@googlegroups.com
So the only difference between prod and dev env. is the callback URL, which is causing difference in response from Google. I am looking into this more, please hang on Danial.

Thanks,
Rocky 

Rocky Jaiswal

unread,
Aug 5, 2014, 5:44:33 AM8/5/14
to adwor...@googlegroups.com
Hi Danial,

You can close this ticket, we restarted our prod server without any code change and it worked as expected after that. The problem was we were seeing different response from Google for different callback urls (staging / production) however this seems to have gone away with the server restart. It is very weird but now we cannot even replicate the problem now so we can just close the ticket.


Thanks,
Rocky
Reply all
Reply to author
Forward
0 new messages