Home > Back-end >  Facebook Client OAuth settings domain not working with query strings
Facebook Client OAuth settings domain not working with query strings

Time:04-05

I'm trying to get the Auth working with Facebook but it keeps on telling me that my redirect URL is not working.

In the Valid OAuth Redirect URIs I have the following

 https://localhost

The issue is that, I'm passing some additional query string to my callback, like

 https://localhost?uuid=something&service=my_service

When attempting to Auth, I do get the request popup and then I get a redirect URL but then Facebook is telling me that the URL is not allowed.

facebook error

If I test https://localhost?uuid=something&service=my_service in Facebook's Redirect URI Validator it's telling me it's not valid

How can I add a a URL including a dynamic query string ? I've tried

 https://localhost*

But Facebook is telling me this is not a valid URL and won't let me save/add this URL.

CodePudding user response:

@ceejayoz put me on the right track, I will answer my own question, that might help someone else.

Additional data must be passed in a state parameter such as

 $data = json_encode($some_std_class);
 $pdata = $fb_helper->getPersistentDataHandler();
 $pdata->set('state', $data);
 $login_url = $fb_helper->getLoginUrl($my_url, $my_permissions);
  • Related