Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google API - Redirect URI with an internal IP

I'm creating an app using Google calendar API. Everything works fine on my local apache install, using localhost:8888/pathtoapp as the redirect URI.

I want to migrate the app to another machine on my local network. I tried changing the URI to the local ip of the new apache install. I get the following error...

Error: invalid_request
Invalid parameter value for redirect_uri: Raw IP addresses not allowed: http://192.168.0.17/pathtoapp/

Any ideas on how I can use an internal IP as a redirect URI or other ways around it?

Thanks.

like image 299
barrylachapelle Avatar asked Oct 05 '12 19:10

barrylachapelle


2 Answers

Looks like the API is not allowing you to use IP addresses. Try to use network name not ip address. If you don't have access to the name, create an alias on your local machine for that specific IP.

like image 194
albattran Avatar answered Oct 05 '22 18:10

albattran


[development environment suitable solution]

Whilst the Google Console will not allow you to have an IP as a redirect URI:

Invalid Redirect: http://10.100.1.1 must end with a public top-level domain (such as .com or .org)

you can create a host name entry which redirect you a valid domain to another the desired IP address:

$ vim /etc/hosts

Append: 10.100.1.1 localhost.com www.localhost.com

Now you can access your site from localhost.com or www.localhost.com and have localhost.com as the redirect URI.

like image 23
zurfyx Avatar answered Oct 05 '22 20:10

zurfyx