Chrismillard – so when you are taken back to your blog, with the oauth code, you just land on your blog homepage and nothing happens?
When you say “the web page for the return URL is empty” do you mean you get just a blank white screen?
If so, that means some kind of PHP error is being thrown – you’ll need access to the server error logs to see what it is.
It may be that your server doesn’t allow wp_remote_request – doesn’t allow WordPress to call Facebook server-side, necessary for getting an OAuth token.
So that would suggest you’ve got some misconfiguration, probably based on having first tried WPBook.
If you just hover over the “generate access token” link in your WPBook-Lite settings page, you should see a link that looks like this:
https://www.facebook.com/dialog/oauth?client_id=XXXXXXXX&redirect_uri=%5Byourblogurl%5D%3Fwpbook=oauth&scope=read_stream,publish_stream,manage_pages,user_groups
Does yours have a different “redirect_uri” that points somewhere else?
My guess is that your Facebook application is still set to be an “App on Facebook” when it should now be “Website with Facebook login”
You’ll just put your blog url in for “Site url” on the “Website with Facebook login” section and make sure the “App on Facebook” section is not filled out
To be clear, I’m talking about the settings for the app you created in Facebook, at https://developers.facebook.com/apps/ – go into edit the app you created
OK, you are correct in that I still had the “App on Facebook” settings. I’ve taken those out, leaving just the Website with Facebook option enabled.
The redirect_uri is correct.
I’ve removed the app from my own privacy settings so that I could go through the re-generation of an access token. I click on Generate an Access token, follow the prompts on Facebook to allow the app to have public access, authority to write etc…, and then it takes me back to my website where I end up with absolutely nothing in the browser window, and the following URL:-
http://mywebdomain.com/?wpbook=oauth&code=AQAgw3Z8YFN9Pox5TJyUpC1Fikpm8YCAkUOOCLonLR8jIaE06P-Bd1o5hTYqyF3uNf1FA66tV-Bi62cjjlrrI9JpfJk9X2LY4TH-hMO_HXEhT3jEc_6fwufsgMlAsxPr4sr88N4xa0a_w_VjzCeZai_xWPBT4SnugalKmRBbFvU_A268dUJ9I-Ql4m3cCEbNmKwyEXYTsyNyNn4V1tdd5qXM5T_hIH1vCbKMzYDGxCZ1r1Kj5hBu4bPF3-GTcHtXYUEYH0ZmZLKPpbYkjagRMvNeLQI73n7yFGxqbFlPOU1gskPTMC7zWBoJvUFG7NAoZmw#_=_
Ok, so at the point that you come back to your own site with that code, you should be seeing in the browser:
Succeeded in saving Access Token Return to your blog\nSucceeded in saving new extended Access Token Return to your blog
(Yes, it isn’t pretty, but that is what it currently looks like). The “Return to your blog” are links.
The question is why your blog isn’t properly processing the code from Facebook – and seems to be dying before it even outputs anything.
This could be a question of plugin conflicts, or Facebook library conflicts, or server configuration.
Do you have access to the PHP Error log for your domain? If so, that might hold the necessary clue to what’s going wrong.
Otherwise, can you try turning off other plugins (except Wpbook lite of course) and trying without them enabled? That might help ID the conflict if that is what it is.
I do have access to the error logs, and am literally on to my hosting provider (hostgator) as I type this, to see if they can point out anything.
Hi John. I’ve seen an entry in the Raw access logs (not the error logs) on my hosting:-
<em>My IP address</em> - - [16/Aug/2013:10:14:21 -0500] "GET /?wpbook=oauth&code=AQAMM44kU2bZgS5Emzio1K4cVwbiHQ_jvqt5zvfyGpoKST5vKjKS8dT7WsGM4QFsLfqMI_KFghlGXjw3sJChLd4sIYx6v9fEwIxqKa6M_k-q1ya1kVrJJjXQg2BNIqZSwNm4yT6IhJfWqlS3CRKdVJZaXrGZ-ui6sGLJNKpwMbFKnlrQ5vRY7tc1wKDdbE-wGXfzEEfLJHposCSNnjyD9EFKqOuhTUaNrsGe2NyxAaM0AG0_8pYC0okP60qhmK1N2nY6cCkbHBzDZWpePS3D8H_t5dvK8PZ9pr5FF5uzy_q8WfQqhYdMGQ-KTyvrKFs-UqI HTTP/1.1" <strong>414</strong> - "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)"
Code 414 makes it look like the URL is too long, and my hosting provider suggested using POST instead of GET. Is that configured in your plugin?
Ah-ha. I turned off ALL plugins except for WPBook Lite, and got a message saying that the access token had been saved. I will keep repeating this after enabling each plugin to see what one is causing the conflict.
Found it! Better WP Security is blocking it. I can re-activate Better WP Security after generating the access token and it then everything works OK – it just needs disabling during the access token generation 🙂
Interesting. Of course my test blog for wpbook-lite is one of the few on which I don’t run Better WP Security.
There are two things it might be doing that Better WP Security may not like:
1. Making remote requests to Facebook from the server – using http://codex.wordpress.org/Function_Reference/wp_remote_request
2. Using the query_vars filter and parse_request to get data out of the code Facebook returns on the redirect string.
I *believe* the way I’m doing both of these is pretty WordPress standard, but maybe I’ll setup a copy with Better WP Security and see if I can find where the issue is.