0

I am using graph api v3.1 with facebook sdk https://github.com/facebook/php-graph-sdk . I need to do facebook login : I have this error Unable to load this URL: The domain of this URL is not registered in those of the application. To import this URL, add all the domains and subdomains of your application to the Domains field of the application settings.

app settings and facebook login settings:

image 1

image 2

image 3

  • What is the URL of the page where you got the error? Is it the same domain as you entered in the FB settings? – Chris Aug 16 '18 at 10:53
  • https://test.ehtaj.com/fb-callback.php the URL in facebook login settings – Hela Halloula GS Aug 16 '18 at 10:56
  • Could you check if the answer given in this question might help you out? https://stackoverflow.com/questions/37063685/facebook-oauth-the-domain-of-this-url-isnt-included-in-the-apps-domain – Chris Aug 16 '18 at 10:59
  • I can get the Facebook login dialog shown on this site without it showing any errors, so I guess it must occur in the step afterwards, where your app tries to exchange the code for an access token. The API call doing that must specify the `redirect_uri` parameter with the exact same value as you had in the login dialog call, so if you generated the login URL in a different script than `/fb-callback.php`, you will need to specify it explicitly while generating the login URL (otherwise the PHP SDK will just take the current URL by default.) – CBroe Aug 16 '18 at 12:36
  • I solved it by adding my OAuth redirect URI as a argument to the getAccessToken function call: $redirectLoginHelper->getAccessToken("https://test.ehtaj.com/fb-callback.php") but I d'ont know if this can be a perfect solution – Hela Halloula GS Aug 16 '18 at 12:53
  • @CBroe I solved it by adding my OAuth redirect URI as a argument to the getAccessToken function call $accessToken = $helper->getAccessToken("test.ehtaj.com/fb-callback.php") – Hela Halloula GS Aug 16 '18 at 13:32
  • thanks a lot all for your help – Hela Halloula GS Aug 16 '18 at 13:33

0 Answers0