I have GAE Application. It uses Oauth 2.0 protocol. I use Java library at the moment. At the moment, I manually switch the redirect URL.
When I'm testing on localhost I use localhost:8888/oauth2callback
And when I deploy app, I set example.appspot.com/oauth2callback.
So how can I detect, if the app is running on the localhost or is deployed ?
As per the documentation, you can do the following
You can check the value of the System property
com.google.appengine.runtime.environment
to determine if it is "Production" or "Development".Sample code from docs:
and so on.
On the Python side of things, check out the following documentation snippet:
You can use oAuthService methods to detect localhost environment
OAuth for Java Overview