How to obtain a Facebook access token?

0 votes

I have a couple of questions:

I'm testing out the Unity sample project, but I cannot figure out what to use as the "fbAccessToken".  The API documentation refers to this as "Facebook Access Token that has been received after authorization."  What authorization?  

1) What step is supposed to precede this to obtain the access token?

Also, when looking at the UpdateFacebookStatus() API call, I see that only a username and the content of the status update are passed as arguments.  No access token or other credentials are supplied.  This leads me to beleive that some prior API calls must be made first.  But which ones?  There is no documentation which specifies which prior Facebook-related API calls must be made before others.

2) What is the order of social API calls?

asked May 29, 2014 in AppWarp by Brady Wright (35 points)

1 Answer

0 votes

Hi Brady,

About "Facebook Access Token that has been received after authorization.", you need to integrate tha facebook SDK because when you login with facebook in your app you will get the access token. That is why its called after the authorization.

About your query for UpdateFacebookStatus,  you need to call linkUserFacebookAccount  first after that you can call the UpdateFacebookStatus function. We can update our documentation for tha same so people can better understand what is right order to use social service.

Also you can work with method which is inbuild in App42 Unity SDK, for that you need to create an app from facebook.

After the success of app creation on facebook you will recieve the facebook appId which you need to pass in below code snipped as input parameter & this will return the facebook accesstoken which you can use for update status or wall post feature : -

string[] perms = new string[4];
perms[0] =;
perms[1] = FBPerms.friends_birthday;
perms[2] = FBPerms.photo_upload;
perms[3] = FBPerms.user_photos;

App42API.BuildSocialService().DoFBOAuthAndGetToken("Facebook_App_Id", perms, true, new UnityCallBack ());

public class UnityCallBack : App42CallBack
public void OnSuccess(object response)
Social social = (Social) response;    
public void OnException(Exception e)
  // Handle here for Exception 

answered May 30, 2014 by hs00105 (517 points)
Where is the DoFBOAuthAndGetToken() API call documented?  I can't seem to find it.
Hi Brady,
This function is available in few SDK. Let me know if you need information regarding this.
Yes, I was looking for documentation for it to learn what the third boolean parameter means.
When trying to use DoFBOAuthAndGetToken(), the device opens a browser and I get a page with the following on all platforms:

Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

It seems to be trying to open some URL with a redirect to  Is this a URL I need to add somewhere to my Facebook App?
Hi Brady,

Please find the URL below which you need to mention in Canvas or Secure URL section in app settings when you create App on Facebook page.
I apologize, I have not mentioned this earlier.
I can't find a place to enter that in the Facebook app settings.  Can you describe in more detail where this URL should be entered?
Hi Brady,

1. First select your app on Facebook page(Apps >> Your App Name).
2. Click on settings.
3. Click on add platform button
4. Select App on Facebook option
5. Enter the URL in Canvas URL &Secure Canvas URL field and save

Let me know if it helps.
I still didn't get one thing.
How do you store accesstoken returned by DoFBOAuthAndGetToken in some local variable?
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on