2

I want to login with FaceBook from mobile devices(WebView). I'm trying to login using the example from this tutorial https://developers.facebook.com/docs/facebook-login/login-flow-for-web

But I'm getting the following error

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

According this manual, I must using faked redirect_uri for oauth service to login from WebView

https://www.facebook.com/connect/login_success.html

Now, connection string looks like this

https://www.facebook.com/connect/ping?client_id=188978851312862&domain=&origin=1&redirect_uri=http://static.ak.facebook.com/connect/xd_arbiter.php?version=29#cb=fc2b211fc&domain=&origin=file%3A%2F%2F%2Ff3b6d7ef1c&relation=parent&response_type=token,signed_request,code&sdk=joey

And if you go to this link, you will get the error. But if i change redirect_uri to this

https://www.facebook.com/connect/ping?client_id=188978851312862&domain=&origin=1&redirect_uri=https://www.facebook.com/connect/login_success.html&domain=&origin=file%3A%2F%2F%2Ff3b6d7ef1c&relation=parent&response_type=token,signed_request,code&sdk=joey

It will succeed.

Is it possible to set faked redirect uri and use standart JS API?

UPD: Actually authorizing complete well, but the API's event (auth.authResponseChange) doesn't fires. The problem in origin parameter in redirect_uri which is set to file:// when I loginnig from mobile's WebView.

CruorVult
  • 823
  • 1
  • 9
  • 17

2 Answers2

0

As far as I can tell, the advice to, if you're in a WebView, "redirect to https://www.facebook.com/connect/login_success.html" is so that it will redirect there, with some auth keys "also in the url" and then you can parse them and close your WebView, so basically a one time callout, FWIW. My other guess is that origin is there, but not actually checked or used by them [?]

In terms of "using the standard JS API" I think you can but it's non trivial see here.

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
-1

https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/v2.0 Are you using this? If you need any more help give me a buzz, just made one of these

Sprout
  • 630
  • 1
  • 5
  • 22