ccoenraets / OpenFB

Micro-library that lets you integrate browser and Cordova apps with Facebook with no plugin or SDK dependency.
MIT License
505 stars 231 forks source link

The redirect_uri URL is not supported! #123

Open guilhermelirio opened 7 years ago

guilhermelirio commented 7 years ago

'I'm testing the login from the desktop, and it's giving this error! The popup link that opens is this:

https://www.facebook.com/dialog/oauth?client_id=XXXXXXXXXX&redirect_uri=file:///C:/Users/SERVIDOR/Desktop/sample/www/oauthcallback.html&response_type=token&display=popup&scope=email

If it is by localhost:8000 (Phonegap Test), it works normally!

oauthcallback.html: <script> window.opener.openFB.oauthCallback(window.location.href); window.close(); </script>

openfb.js: http://pastebin.com/KsJzNFnN

Where is the error?

Thanks!

guilhermelirio commented 7 years ago

I`m using JSConsole.com for tests! Return:

Connection established with file:///android_asset/www/login.html Mozilla/5.0 (Linux; U; Android 4.1.2; pt-br; ST27i Build/6.2.A.1.100) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

Ok, but when I click the login button, it gives the following error:

screenshot_2017-03-14-19-42-19

Someone to help me?

lf94 commented 7 years ago

I'm having this issue too.

lf94 commented 7 years ago

Apparently file:// URL is not valid...

josvaler commented 6 years ago

I wonder to know why you guys are trying to use a local url like

file:///C:/Users/SERVIDOR/Desktop/sample/www/oauthcallback.html&response_type=token&display=popup&scope=email

Of course this is not a valid url, the limitation is because Facebook.

// Default OAuth redirect URL. Can be overriden in init() oauthRedirectURL = baseURL + '/oauthcallback.html'

where /outhcallback.html depends of baseURL.

baseURL takes the Facebook Settings under "Valid OAuth redirect URIs", in other words this is the expected behavior in my understanding.