Should Google Oauth2.0 Web Authorized Redirect URIs end with a public top-level domain (such as .com or .org)?

When you create the Oauth2.0 API API credentials on the Google Developers Console , I select the application type "Web Application".

In the field "Authorized URI redirects" I can use http://127.0.0.1/callback , it works fine for me in local development.

but when I want to use the Google Oauth2.0 API credentials on my server (say 99.99.99.99), I need to use http://99.99.99.99/callback as my "Authorized Redirect URIs", but google gives me warning:

Invalid redirect: http://99.99.99.99/callback must end in a public top-level domain (e.g. .com or .org)

Except that a public top-level domain is connected to my server, what else can I do?

I am developing Django and am using oauth2client to work with the Google Oauth2 API. So there are two tables: "oauth2_authentication_credential", "oauth2_authentication_flowmodel", in my database, which has credential value, I copy them from my local host to the server, but it does not work.

+6
source share
1 answer

The "Allowed URI Redirects" field has a help text that clearly states that you cannot use public IP addresses:

Authorized Redirect URIs

For use with requests from a web server. This is the path in your application to which users are redirected after they are authenticated using Google. The path will be added using an authorization code for access. Must have a protocol. Cannot contain URL fragments or relative paths. Cannot be a public IP address.

127.0.0.1 not a public IP, but loopback , so http://127.0.0.1/callback works fine. localhost can also be used: http: // localhost / callback

Except that a public top-level domain is connected to my server, what else can I do?

You can use the free DNS http://xip.io/ . Therefore, for IP 99.99.99.99 use http://99.99.99.99.xip.io/callback . And it would be decided http://99.99.99.99/callback .

+11
source

All Articles