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.
Setup steps To test a web OAuth client you can still use a localhost deployment, provided you have administrator (superuser) permissions to modify the local lookup table for hostnames.
A redirect URI, or reply URL, is the location where the authorization server sends the user once the app has been successfully authorized and granted an authorization code or access token.
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]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With