views:

27

answers:

2

Hi there, to connect to an app on facebook, the user types in

www.facebook.com/login.php?api=12312312323123123

how can I add an extra get var to this url and pass it to my script on successful login?

+1  A: 

Do you add a redirect_url as part of the login call?

If so you can add the GET parameter to that. For instance let us say you are asking Facebook to redirect to http://tld/fbhandler after user logs in. You can change that to http://tld/fbhandler?extra=value.

This URL is specified at the time of making the (OAuth) login call to Facebook and therefore you can change the value as you see fit.

Manoj Govindan
+1  A: 

You cannot do this. Facebook will strip custom query values from the url. I have found that there are two ways to do this. The first is that they will let you have a single query value at the end of the url if you encode the ? to %3F. For example:

redirect_url=http://www.example.com%3FmyextraParameter

You could use this approach to do something like base64url encode your values and add them at the end.

The other thing that I have done is to change the parameters to be path variables

redirect_url=http://www.example.com/realUrl/parameter1/parameter2

Neither are great solutions, but I have yet to find a way to send querystring values without them being stripped off.

Nathan Totten

related questions