Is there a way to specify a dynamic callback url for the redirect from Facebook authorization? Facebook app is requiring to enter a url with a slash at the end. What I am trying to do is to do is add a username or the app key so I can do some dynamic logic on the callback url page. I would like to use the same callback url for many users, so even parameters would help.
As far as i know you can not append parameters like you want.
But in some cases parameters get appended by facebook (e.g. auth_token in OAuth).
Related
I have created a Facebook Application which will be used as a Facebook Tab Page. My problem is that I am unable to get the page id.
I want to use this single application for multiple Facebook Page Tabs but the content will vary based on the Page Id.
The code I am trying to use to get the signed_request is using the JavaScript SDK.
FB.getLoginStatus(function(response) {
console.log(response);
})
This can be done with the signed_request parameter, which is passed on to your URL.
The easiest solution is to use the PHP SDK. It offers a function called "getSignedRequest": https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest
Those are the fields of the signed_request parameter: https://developers.facebook.com/docs/reference/login/signed-request
If you don´t want to use the PHP, you need to parse the parameter on your own. Check out this link for more information and search for "Parsing the Signed Request": https://developers.facebook.com/docs/facebook-login/using-login-with-games
Edit: you will not get the correct signed_request using the JavaScript SDK. Use PHP (or your server language) for this.
The mistake was that the URL added in the Facebook page tab settings was getting redirected as it did not have a "/"; there was a redirect for SEO added and the URL in the Facebook APP sittings did not have the "/".
So as it was getting redirected Facebook sent the POST variable but we have not handled it. Now it is fixed.
Special thanks to #luschn and #Fran Barbero for all your efforts in this.
I have a app which url is like:
https://www.facebook.com/Foo/app_123456789
this app is running in a iframe and loading some urls of my server. At the start the user see a page like[1]:
www.foo.com/index.php
but in the app you also get pages like[2]:
https://foo.com/foo1/test/Tab/New/12345-6789
now the question:
is it possible to get a link which start with facebook.com/... and directly lead you to the [2] url?
Yes it is possible. You can add an extra variable to your URL like so:
https://www.facebook.com/Foo/app_123456789?app_data=any_string_here
Facebook will then send whatever inside the app_data variable to your iframe inside the singed_request. So all you have to do is to check for its presence (and value) and redirect the user accordingly.
I am trying to create facebook app, and I do not know how to pass the querystring.
How do I pass a querystring parameter to facebook app?
I have added my url to canvas url in facebook app.
http://www.pollsdb.com/get.aspx?qtnid=1&width=239&headerhight=40&height=204
I want users to be able to access different polls by changing the qtnid in the querystring.
How should I do this?
A query string you give in your canvas URL settings gets passed as it is.
If you want to link to your app from outside, you have to use the app_data parameter – everything you put in there gets passed to your app as well. If you need to transfer multiple values, JSON encode them before assigning them to app_data or something like that.
Hi i have a multiple page facebook fan page app in asp.net c#. how do i set and retrieve that app_data querystring? is this part of the signedrequest or the actual url of the fan page? will there be cross domian issues in getting this in safari and ie?
i can get the signed_request using the following:
if (!string.IsNullOrEmpty(signedRequest))
{
dynamic SignedRequestData;
var DecodedSignedRequest = FacebookWebContext.Current.SignedRequest.Data;
SignedRequestData = DecodedSignedRequest
so basically on the first page i want to get the signed_reqeuest using the above and then append this to the url in app_data querystring. on all other requests i can then get this and use those values to check user status, liked, logged in etc. This way i think it will stop the cross domain cookie issues in safari. anyone agree or disagree with this?
has anyone done this?
cheers
You can set the app_data as:
https://www.facebook.com/{page_id}?sk=app_{app_id}&app_data={"key1":"value1","key2":"value2"}
You can pass multiple values into app_data and it will be returned in the signed_request to your actual page as (POST data).
What you should really do is get the signed_request on first page load from POST, and add it to the URL of your app as ...?signed_request={signed_request_string}. Every page should then pass this around in the URL so you can easily check the like and admin status from any sub-page. You don't need to use app_data for this. And in any case, the data will be lost after the any subsequent click / redirect in your app.
i'm looking for a solution to proceced deeplinks to a facebook fanpage like:
http://www.facebook.com/myfanpage?sk=app_MYAPPID¶meter=2
I need to get the value of parameter in my Fanpage app.
Use the app_data parameter in your link, and the value of this will be passed to your app in the signed_request which is sent on page load. Many developers use JSON encoded data as the value for app_data as they want to store multiple values
This is documented here: https://developers.facebook.com/docs/appsonfacebook/pagetabs/#integrating
I don't understand clearly but what you want is getting parameters from url in facebook is not possible in pagetabs i tried it many times but it won't work.
The only way getting parameters from url in facebook is creating canvas app. Because canvas apps act like domain so you can use whole parameters and urls.
If i missunderstood sorry for it.