开发者

Running Canvas app in a Tab

开发者 https://www.devze.com 2023-04-04 11:22 出处:网络
This is my first Facebook app and I\'m on quite a tight deadline so forgive me if any of this is a dumb question.

This is my first Facebook app and I'm on quite a tight deadline so forgive me if any of this is a dumb question.

I've set up a Canvas app, I've got it to authenticate by passing the parameters to the facebook URL:

https://www.facebook.com/dialog/oauth?client_id=1234&redirect_uri=MY_APP_URI

I can then get the user_id and name of the user, which for this particular app is all I need. It runs fine in the Canvas page.

Problem is I can't get it to run in a tab, it always redirects to the Canvas, which is not what I want - I need it to run within the context of my client's Facebook page. I've been trying to find examples of setting it up but everything seems to be out of date compared to w开发者_如何学JAVAhat I'm seeing in the App settings.

My settings at the moment are:

App on Facebook
Canvas URL: http://localhost/facebook/
Canvas Page: http://apps.facebook.com/MYAPP

Page Tab
Page Tab Name: My test app
Page Tab URL: http://localhost/facebook/

I presume I'm missing something obvious, so if someone can advise I'd be grateful. For what it's worth I'm using .Net webforms and have the C# SDK installed, but don't think I'll need to really use it for this example.

EDITED TO ADD I'm sure its to do with the authorization - I've followed the guide here developers.facebook.com/docs/appsonfacebook/tutorial on how to redirect the page back with the authorization payload, but obviously doing that has kicked it out of the tab and into the main Canvas again. I need to to stay where it is, if such a thing is possible.


localhost points from your local machine to itself. Facebook does not know what localhost relates to and cannot load the app. You need to make your app accessible from outside of your machine.


It was the fact that I was still redirecting the url, when you run in a tab you don't need to redirect to another url to get the user data, it's just there waiting.

0

精彩评论

暂无评论...
验证码 换一张
取 消