Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8002811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:28:46+00:00 2026-06-04T16:28:46+00:00

I have a Facebook canvas app. I am using the JS SDK to authenticate

  • 0

I have a Facebook canvas app. I am using the JS SDK to authenticate the user on the browser-side and request various information via FB.api (e.g. name, friends, etc.).

I also want to persist some additional user information (not held on Facebook) to the database on my server by making an ajax call:

{ userFavouriteColour: "Red" }

To save this on the server and associate with the correct user, I need to know the Facebook uid and this presents a problem. How do I pass the uid from the client to the server.

Option 1: Add uid to the ajax request:

{ uid: "1234567890",
  userFavouriteColour: "Red" }

This is obviously no good. It would be trivial for anyone to make an ajax request to my web service using someone else’s Facebook Id and change their favourite colour.

Option 2: On the server, extract the uid from a cookie:
Is this even possible? I have read that Facebook sets a cookie containing the uid and access token but do I have access to this cookie on my domain? More importantly, can I securely extract the uid form the cookie or is this open to spoofing just like option 1.

Option 3: User server-side authentication on the server:
I could use the server-side authentication to validate the user identity on my server. But will this work if I am already using client-side authentication on the browser? Will I end up with two different access tokens? I would like to make FB.api requests from the browser so I need the access token on the client (not just on the server).

This must be a very common scenario so I think I’m missing something fundamental. I have read a lot of the Facebook documentation (various authentication flows, access tokens, signed_request, etc.) and many posts on SO, but I still don’t understand how client-side authentication and server-side authentication play nicely together.

In short, I want to know the user’s identity on the server but still make requests to the Facebook api from the client browser?

(I am using ASP.NET and the Facebook C# SDK on the server)

EDIT: Added bounty. I was hoping to get a more deifnitive, official recommendation on how to handle this situation, or even an example. As said, I have already read a lot of the official FB docs on authentication flows but I still can’t find anything definitive on how client-side and server-side authentication work together.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:28:48+00:00Added an answer on June 4, 2026 at 4:28 pm

    Option 1:
    The easiest way I can think of is to include the accessToken in JS and pass it with the ajax call.

    Option 2:
    Using the same as option 1, but instead of sending just the accessToken, send the signedRequest.

    On the server side you can decode it using (TryParseSignedRequest method) which will give you the UserID 🙂

    Note: signedRequest is encrypted with the application Secret. you are the only one who should know it, so you are safe on that end.

    Disclaimer:

    I have no coding experience in C#, but a little search in google gave me this:

    Facebook C# SDK for ASP.NET

    Making AJAX Requests with the Facebook C# SDK

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have downloaded Prabir's application ASP.NET MVC Canvas App using Facebook C# SDK showing
I have a Facebook canvas app, written in AS3, and using the Adobe Facebook
I'm creating a mvc3 canvas app using facebook c# sdk The method name is
I have built an app using the facebook canvas method. This works in Mozilla
I have a facebook app that a user can send an app request to
I have facebook login setup in my android app. When the user clicks login
I am migrating my Facebook canvas application to using the new PHP SDK. However,
When implementing a Facebook Canvas app using an iframe the iframe does a post
I've developed a Facebook application using the Facebook C# SDK. Interestingly, whenever the user
I try to get all user photo by using FQL (Facebook C# SDK, ASP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.