---
title: "Should I pass access token when using FB.api()?"  
description: "Should I pass access token when using FB.api()?"  
author: "Samuel Fernandes"  
published: 2013-05-20  
updated: 2013-05-20  
canonical: https://www.mindstick.com/forum/916/should-i-pass-access-token-when-using-fb-api  
category: "facebook api"  
tags: ["facebook api"]  
reading_time: 1 minute  

---

# Should I pass access token when using FB.api()?

Hi!\
I'm just a little confused as to how to pass my [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) token into FB.api() when making requests for protected things.\
I'm getting my app to [login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) and authenticate fine, but how do I use FB.api() with the access token I have?\
app.accessToken = [response](https://www.mindstick.com/forum/12719/how-to-make-response-write-display-special-character-like-lt-gt).authResponse.accessToken; // This is a valid access token.\
FB.api('/me/[friends](https://answers.mindstick.com/qa/31396/where-did-the-suggest-to-friends-feature-go)?access_token='+app.accessToken, {[fields](https://www.mindstick.com/forum/159126/sql-query-for-all-tables-and-fields-in-an-oracle-db): 'name,id,[location](https://www.mindstick.com/blog/11636/relocating-business-or-office-to-another-location),[picture](https://answers.mindstick.com/qa/38554/name-the-oscar-winning-sound-designer-who-became-the-first-asian-to-win-the-award-for-best-sound-for-documentary-india-s-daughter-at-the-coveted-motion-picture-sound-editors-63rd-annual-golden-reel-awards),installed'}, [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)(response) { console.log(response);});Is that the correct way to pass in the access token to FB.api()?\
In this case, my response comes back with the friends name,id,location,picture but it doesn't seem to have the 'installed' data as that is protected.\
Am I doing this [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not)? Please [Guide](https://www.mindstick.com/articles/44463/business-to-business-vat-reclaiming-a-guide-for-your-employees) me!\
Your help is greatly appreciated.\

## Replies

### Reply by AVADHESH PATEL

Hi Samuel!\
You do not need to pass the token, if the user logged in (with FB.login, for example). In fact, by using the JavaScript SDK (or PHP SDK), you almost never need to deal with the (user) access tokens.\
So, your call would just be like this:\
FB.api('/me/friends', function(response) { console.log(response);});


---

Original Source: https://www.mindstick.com/forum/916/should-i-pass-access-token-when-using-fb-api

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
