Is there a way to add multiple valid OAuth Redirect Uri’s to your Facebook App programmatically?

I’m creating a WordPress plugin which lets the user connect his/her Facebook account, and in my Facebook App settings, I have specified the Redirect URI, but when the plugin is installed on other domains, I get an error that “Given URL is not allowed by the Application configuration…and etc.”.
Now, I want every time if there’s a new user who install the plugin, I want to get the domain name and add it programmatically to my Facebook App’s Valid OAuth Redirect URIs. Is this possible?

Related posts

1 comment

  1. Since you considered my answer to your question on the FB Developer Group helpful, I’ll copy it over to here:


    It is not possible to set Valid OAuth Redirect URIs for an app via API.

    You have basically two options here:

    1. Use your own domain to handle the login part. Use it as the redirect_uri in login dialog calls, and when users get redirected back to your domain from the login dialog, direct them back to their domain from there. Pass their domain as a URL parameter in your redirect_uri, or store it in your session.

    2. Let users use your plugin with their own app id. If your plugin is not meant to be used by the public, but by the site owners themselves only (to publish their blog entries onto their FB page), they don’t even have to go through review to get the permissions your plugin asks for approved.

    The second option is also the “safer” one for you. If someone publishes spam via your plugin, it might at one point get the app blocked. Now if you use one app for all users, they’ll all be sitting in the same boat – one misbehaves, app gets blocked, and all content posted via it will disappear (maybe only temporarily, if you can get your app unblocked in the appeal process, otherwise forever.) And that’ll mean a lot of angry support requests from your users …

    If everyone uses your plugin with their own app id – then they will only get that blocked if they spam, and everyone else can continue to use your plugin using their own apps.

Comments are closed.