prabirshrestha / FacebookSharp

Facebook Graph API for .Net
Other
30 stars 15 forks source link

ASP.NET MVC + Facebook Canvas #9

Closed BenBach closed 14 years ago

BenBach commented 14 years ago

I am struggling right now combing a facebook canvas applikation with ASP.NET MVC.

I got it working to get a accesToken. But if more then one user is accessing the website they are all using the same access token.

Does somebody might now a solution? Would be a great help

Ben

BenBach commented 14 years ago

Basically i want to create a ASP.NET applikation nested in an iframe facebook app without any special membership (without register)

prabirshrestha commented 14 years ago

"But if more then one user is accessing the website they are all using the same access token." in facebook, only one user can be logged in at a time, so you have to request the access token for that particular user. at the moment in the canvas sample, i store the access token in session, you might want to store that in a database along with the facebook user id, so when u query the facebook user id and if it doen't return any access token, make sure you request permissions and get the access token for that user.

most probably since the session hasn't expired ur getting the same access token.

let me know if u have any problems (feel free to ask).

BenBach commented 14 years ago

Thank you very much!

Right now i am struggling retrieving the facebook user id before doing any form of authentification.

I need to know the user id to know if i have to do a OAuth authentification.

prabirshrestha commented 14 years ago

you do not need to know the userid if u want to do the oauth authentication.

the first thing is to get the OAuth access token.

then once you get the access token, you can get the user's id or any other details.

to get user's id.

var fb=new Facebook("access_token"); var user = fb.Get("/me"); var userId=user.ID;

Have you got the access token yet?

BenBach commented 14 years ago

Hi thanks for your help.

The problem was that i had a source from a week before. So i was missing P3PHeaders.

prabirshrestha commented 14 years ago

Great to hear that the problem is now solved.

Incase you have more problems feel free to ask.