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?
1 comment
Comments are closed.
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:
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.
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.