views:

255

answers:

2

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 my 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?

+1  A: 

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);
Sarfraz
Actually I use the c# facebook SDK. first want to get the authentication_token so that i get the facebook session key and than store it to database for further use.ConnectSession _connectSession = new ConnectSession(fbApi_key, fbSecret_key);<br> Facebook.Rest.Api _facebook_Api = new Facebook.Rest.Api(_connectSession);session_info session = facebook_Api.Auth.GetSession(auth_token);_facebook_Api.Session.SessionKey = session.session_key;
qulzam
Then redirect to that url i have posted any way you do in C#.
Sarfraz
A: 

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.

serg

related questions