Facebook cannot redirect the next parameter
When I authenticate the user, after authentication it does not redirect the next parameter. Instead it redirect the user to the "Canvas Callback URL". If I dont give the convas callback url. then it gives the error An error occurred with experiement. Please try again later. API Error Code: 100 API Error Description: Invalid parameter Error Message: next is not owned by the application.
on the other hand if the user cannot allow m开发者_开发百科y app then it redirect the next parameter.
My url for authentication is:
https://login.facebook.com/login.php?api_key=**KEY**&v=1.0&popup=1&next=**NEXT**&
next_cancel=**NEXT_CANCEL**&skipcookie=1
I try to this on localhost.
in any one have idea about this?
Try using this url instead to get permissions:
$facebook->redirect('https://graph.facebook.com/oauth/authorize?
client_id=[YOUR APP ID]&
redirect_uri=[YOUR APP URL]&
scope=publish_stream, offline_access');
Replace [YOUR APP ID]
with application id that you can see from application settings where you created the site in Facebook Developers section. Also replace the [YOUR APP URL]
with your app url.
And $facebook
variables is the one you get by initiating the facebook client that is:
$facebook = new Facebook($appapikey, $appsecret);
Yes it always redirects to canvas url instead of app url. You just need to create your own server side redirect that would redirect user back to app url.
You can separate regular app calls from the one after authorization that requires manual redirect by looking at request parameters. After authorization you would get some unique params like auth_token
that are not present in a regular request. If those params are present - it means that it is authorization redirect and you need to send user back to app url.
精彩评论