Google API - How to redirect URL to my localhost
authentication, cordova, ipad, localhost
Solution
You can use Rewrite Rules too.
For example, I need this callback for Google : `http://local.dev/users/login-google`
So I have set this URL in Google Console : `http://localhost/JUMP/local.dev/users/login-google`
And in apache, a simple redirect :
RewriteEngine on
RewriteRule ^JUMP/(.+)$ http://$1 [R,L]
Problem
I am working on integrating google login in my Phonegap app using Google OAuth. What happens is that while creating a client ID for my app, I have to choose "Installed Application" and then the application type as "Others" since I am creating my app using Phonegap. This gives me two redirect URIs such as "`urn:ietf:wg:oauth:2.0:oob`" and "`http://localhost`". I am not opting to go with "`urn:ietf:wg:oauth:2.0:oob`" as it requires the user to copy the code and put it back to the app. The other option that I have is redirecting to localhost. Here the problem is that how do I redirect the URL to localhost when I am on iPad? I have tried to use different redirect URIs but Google doesn't let me use them. It sticks only with redirecting to localhost (or adding some port numbers) which I have no other go. Does anyone have any workaround on this? Are there any methods to accomplish this task? I am stuck. Please help.