Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook C# SDK - Problem with Iframe app and Safari Cookies
    primarykey
    data
    text
    <p>I'm building an Iframe canvas application for Facebook. I'm not using the Javascript SDK.</p> <p>This is the code I'm using, and it works well in all browsers except for Safari.</p> <pre><code>protected FacebookApp app; </code></pre> <p>protected CanvasAuthorizer cauth;</p> <p>Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""); app = new FacebookApp(); cauth = new CanvasAuthorizer(app); if (!cauth.IsAuthorized()) { myAuth auth = new myAuth(); myAuth.Authorize(app, Request, Response, perms); }</p> <pre><code> if (cauth.Authorize()) { </code></pre> <p>// Do my app stuff here }</p> <pre><code>public class myAuth { public static void Authorize(FacebookApp fbApp, System.Web.HttpRequest request, System.Web.HttpResponse response, string perms) { Authorize(fbApp, request, response, perms, null); } public static void Authorize(FacebookApp fbApp, System.Web.HttpRequest request, System.Web.HttpResponse response, string perms, string redirectUrl) { Uri url = fbApp.GetLoginUrl(); NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(url.Query); if (!string.IsNullOrEmpty(perms)) nvc.Add("req_perms", perms); if (!string.IsNullOrEmpty(redirectUrl)) nvc["next"] = GetAppRelativeUrl(redirectUrl); else if (request.QueryString.Count &gt; 0) nvc["next"] = GetAppRelativeUrl(request.Path.Replace(request.ApplicationPath, string.Empty).Replace(request.ApplicationPath.ToLower(), string.Empty) + "?" + request.QueryString); else nvc["next"] = GetAppRelativeUrl(request.Path.Replace(request.ApplicationPath, string.Empty).Replace(request.ApplicationPath.ToLower(), string.Empty)); UriBuilder ub = new UriBuilder(url); ub.Query = nvc.ToString(); string content = CanvasUrlBuilder.GetCanvasRedirectHtml(ub.Uri); response.ContentType = "text/html"; response.Write(content); response.End(); } public static string GetAppRelativeUrl(string url) { return CanvasSettings.Current.CanvasPageUrl.ToString(); } } </code></pre> <p>I read about Safari not allowing third party cookies, and I figure that's where the problem lies. My question is wheter there's a way to handle this using the SDK, or what my options are.</p> <p>Regards, Anders Pettersson</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload