Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pass parameters to the callback URL of a FB app which is accessed through a tab?

Tags:

facebook

I have this facebook application which adds a custom tab to fan pages. You access the tab by an URL like:

http://www.facebook.com/pages/PAGE-NAME-HERE/PAGE-ID?v=APP-ID

I want to be able to add some extra get parameters to that URL, but it seems they don't get passed correctly because facebook is filtering them. Is there a way to pass those parameters? Even not via GET but some other kind of technique.

like image 677
The Coding Monk Avatar asked Jan 08 '11 13:01

The Coding Monk


People also ask

How do I create a call back URL on Facebook app?

To be able to setup a callback URL your website must use the HTTPS protocol. First login to you Facebook developers account and open your application. From the sidebar menu select “Add Product” and then “Webhooks”. From the dropdown menu select “Application” and then click on the “Subscribe to this topic” button.

What is callback URL in Facebook?

The "Callback URL" is the URL that will be contacted once the user has accepted or rejected the OAuth request. This is set as a parameter of your OAuth request.

How do I pass parameters to URL?

The question mark immediately following the extension of the template in the URL specifies the beginning point for appending URL parameters. Each URL parameter consists of a parameter name followed by an equal sign, then the value assigned to the parameter.

How does a callback URL work?

Callback URLs are the URLs that Auth0 invokes after the authentication process. Auth0 redirects back to this URL and appends additional parameters to it, including an access code which will be exchanged for an id_token , access_token and refresh_token .


1 Answers

If you want to pass multiple querystring params though the app_data param, you can urlencode it.

All querystring params that need to propagate through a Facebook tab should be url-encoded in the app_data var.

In other words, the "&" and the "=" need to be url-encoded (especially if passing more than one param).

Examples

GOOD TAB URL (this passes all 3 params):

https://www.facebook.com/pages/yourpagename/56789?sk=app_12345&app_data=var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow

In the app_data from this signed request, I got this value: var1=123456789&anothervar=rawr&athird=meow

BAD TAB URL (this passes only the first param through the signed_request):

https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=var1=123456789&anothervar=rawr&athird=meow

In the app_data from this signed request, I ONLY got this value: var1=123456789 (Facebook dropped the rest)

You can even give your media team instructions like this =)

Media team,

Here is an online utility to urlencode the querysting data you want to embed in the app_data param: http://meyerweb.com/eric/tools/dencoder/

Base Url: https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=

Steps:

  1. Go to http://meyerweb.com/eric/tools/dencoder/
  2. Type var1=123456789&anothervar=rawr&athird=meow in the box
  3. Hit the Encode button
  4. You’ll get var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow which becomes your app_data param. Append that to the baseUrl noted above like this: https://www.facebook.com/pages/yourpagename/12345?sk=app_56789&app_data=var1%3D123456789%26anothervar%3Drawr%26athird%3Dmeow (this is the URL with the tracking params for the [banner ad] [online media] [etc])

p.s. Querystring params in non-tab pages are handled fine (https://apps.facebook.com/yourappname/Canvas.aspx?var1=123456789&anothervar=rawr&athird=meow does not strip out qs params like what happens in the Tab, for example).

like image 59
TruncatedCoDr Avatar answered Oct 16 '22 10:10

TruncatedCoDr