Friday, March 18, 2016

Mobile Cordova / phonegap facebook login without plugin, using only url

Leave a Comment

This login system is working perfectly on desktop clients. The user is redirect to facebook to allow the app and then redirected to my website:

"https://graph.facebook.com/oauth/authorize?client_id=" + client_id + "&redirect_uri=" + redirect_uri + "&scope=" + scope;  

However, in cordova/phonegap, that url is sent but this error is received in chrome:

http://undefined/proxy/https://graph.facebook.comhttps://www.facebook.com/dialog/oauth?client_id=1567960953444888&redirect_uri=this_is_correct%2Ffacebook_login.php&scope=user_friends&state=1 net::ERR_NAME_NOT_RESOLVED

My server login is made so that I just need to output "success login" to the user. So, even if the actual login wasn't working at least there should be output of this message. Any wonder on what might be happening?

1 Answers

Answers 1

I think it can be caused by two things.

Maybe the url can't be resolved due to whitelists. Use this plugin if you aren't using it, and use wildcards just for test

https://github.com/apache/cordova-plugin-whitelist

If not, are the desktop login using some kind of cookies? Maybe you have to use it.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment