How To Manage Final Process Of Facebook Application Authorization / Sign Up
Hi I was wondering if someone could help – I've set a Facebook application up and it all seems to be done correctly. I went through all the tutorials provided by FB. However I have one problem which seems to be stopping my site from being properly integrated.
I have my application page set up and when people click on 'Go To App' they are taken to the permissions page - then they click ‘allow’ - but instead of being taken to my app inside the Facebook Canvass / Iframe they are directed straight to my main www.mysite.com domain. On all the tutorials I have watched on youtube etc, people are always taken to the App shown within Facebook after they press 'allow' - but mine goes out of facebook and to my normal main domain.
The canvas url I have used is the same as this with my site and ID added
http://www.facebook.com/dialo开发者_如何学JAVAg/oauth/?scope=email,user_birthday& client_id=123050457758183&redirect_uri=http://www.example.com/response&response_type=token
Does anyone know what I'm doing wrong? I am thinking one possible thing is should I have a redirect from my site once the canvas URL sends them over which then redirects the user straight back to my facebook app page? this would be http://apps.facebook.com/mysite/ - is this what needs to be done perhaps?
It just seems strange because my site is a kind of dating app and it should work in the same way as something like Zoosk. I would have thought really there should be a URL to initially direct them when they first sign up so I can collect their info and add them as a user, and then another normal one they go to as more of a 'home page'. I think before this was possible but now there is just one 'Canvas URL' to send people to from the 'go to app' button.
I already have facebook connect on my main site and when people sign up through this it all runs smoothly - once its done it adds my site as an app to peoples profile and they can press go to app and use it within iframe without any problem. So there is not problem signing up from my site to facebook, but there is a problem signing up from facebook to my site.
I'm a little confused with it all and I hope someone can maybe help me make sense of it.
Thanks Nikson :)
Have you tried it? :-)
Yes you need to link to your Canvas Page that is your application inside facebook (http://apps.facebook.com/mysite/
).
Now from the documentation:
<?php
$app_id = YOUR_APP_ID;
$canvas_page = YOUR_CANVAS_PAGE_URL;
$auth_url = "http://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($canvas_page);
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
} else {
echo ("Welcome User: " . $data["user_id"]);
}
?>
When you create an account for an app or game using Facebook, you can give it permission to share your activity or personal information. To control your app or game permissions when signing up: Before clicking Play Now or Send to Mobile, click Review the info you provide below the info the app will receive. Choose the info you want to share (example: friend list, birthday). Continue signing up. Keep in mind that you can edit your privacy settings for an app or game at any time.
精彩评论