registering localhost as redirect_uri

6,449 views
Skip to first unread message

Brock

unread,
Mar 6, 2011, 1:06:27 AM3/6/11
to oauth...@googlegroups.com
Hi there,

I'm trying to register http://localhost/ as a redirect_uri for oAuth 2 (in the api console at https://code.google.com/apis/console) but it keeps telling me that it is invalid.

Is this intentional? Can it be opened up so I can test in my development environment?

Thanks

Brock

Andrew Wansley

unread,
Mar 6, 2011, 6:22:20 PM3/6/11
to oauth...@googlegroups.com, Brock
Hey Brock,

Short answer: Yup, it's a known issue—we'll be adding support for localhost redirects in OAuth 2.0 in a shortly coming release.

Two workarounds until that's available: you can add a line in your /etc/hosts file that redirects to localhost from something that looks like an internet-routable domain, or host a file somewhere like appengine that does that redirect for you, passing along the code or token.

Thanks,
Andrew

Brock Moore

unread,
Mar 6, 2011, 7:53:55 PM3/6/11
to oauth...@googlegroups.com
Ok sounds good. Thanks for your help

Brock

Andrew Wansley

unread,
Mar 10, 2011, 9:56:43 PM3/10/11
to oauth...@googlegroups.com
We've updated our URLs, and the localhost issue should be fixed on the new URLs. 

Nathan Hazout

unread,
Nov 29, 2011, 8:20:41 AM11/29/11
to oauth...@googlegroups.com
I think that you now allow "localhost", however you only accept this specific one.
Since I work on several websites at the same time on my local machine, I create dummy domains for each.
For example, localhost.project1 , localhost.project2 .
Those types of domains don't seem to work.

Marius Scurtescu

unread,
Dec 1, 2011, 1:44:50 PM12/1/11
to oauth...@googlegroups.com
Hi Nathan,

Yes, the dummy URLs you show as example will not work. A native
application supports only localhost, but you can use different ports.
Would that work for you?

Another option is to create and register dummy redirect URIs that have
real TLDs, like project1.com, project2.com etc.

Marius

Reply all
Reply to author
Forward
0 new messages