JavaScript API for Facebook

I've been attempting to retrieve my status from Facebook using the JavaScript API. Below is the code I have been using:

    <div id="fb-root"></div>
<div id="data"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">

(function(){
    FB.init({
        appId  : 'SOME ID',
        status : true, // check login status
        cookie : true, // enable cookies to allow the server to access the session
        xfbml  : true  // parse XFBML
    });
});
getData();


function getData(){
    var query = FB.Data.query('SELECT message FROM status WHERE uid=12345 LIMIT 10');


    query.wait(function(rows) {
        for(i=0;i<rows.length;i++){
            document.getElementById('data').innerHTML += 'Your status is ' + rows[i].message + '<br />';
        }
    });
}

</script>

Retrieving my name works fine, but encountering issues with retrieving status updates. Could anyone provide assistance in troubleshooting this matter? The documentation has not been very helpful. Please note that I have used a fake UID and included my app ID. Help would be greatly appreciated.

Answer №1

For full access to the user's News Feed, you must have the "read_stream" extended permission. Check out this link for more information: http://developers.facebook.com/docs/authentication/permissions

The read_stream permission allows your application to search and view all posts in the user's News Feed.

To request permissions, refer to this link: http://developers.facebook.com/docs/authentication/. Pay attention to the section on requesting additional permissions:

If you need access to private profile data or want to publish to Facebook on behalf of the user, extended permissions are required. Use the scope argument in your OAuth authorization request with a list of permissions you wish to request.

For example, this authorization request requests access to user photos, videos, and permission to publish to the user's stream:

https://graph.facebook.com/oauth/authorize?client_id=...&redirect_uri=http://www.example.com/callback&scope=user_photos,user_videos,stream_publish

To request additional extended permissions, redirect to the same authorization URL with the desired permissions. Existing permissions will be excluded, and only new permissions will be requested.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing a self-invoking function to incorporate JavaScript

In my role, I am responsible for managing a Content Management System (CMS) used by developers to create content that involves JavaScript. In the past, we placed the content in an iFrame for containment purposes; now, it operates as a single-page client-si ...

Can you tell me if the "dom model" concept belongs to the realm of HTML or JavaScript?

Is the ability to use "document.X" in JavaScript to visit an HTML page and all its tags defined by the HTML protocol or the ECMAScript protocol? Or is it simply a choice made in the implementation of JavaScript, resulting in slight differences in every bro ...

View complex response objects in Postman as easily digestible tables

I am interested in displaying the data provided below as a table using Postman Tests. The table should have columns for product, price, and quantity, with Items listed in rows. It's important to note that there may be multiple shippingGroups within th ...

Passing the value of the selected calendar date to the controller

How can I pass the value generated by this calendar_date_select to the controller? Any suggestions on how to modify the onchange code? <%= calendar_date_select_tag "meeting_date_1", @time, :embedded => true, :time => true, :minut ...

Conceal items by clicking using raycasting technology

I'm trying to hide scene objects by clicking on them, but after following multiple tutorials on "raycaster", I'm having trouble identifying where the issue lies. When I open my HTML file, all the objects are hidden, even though I've removed ...

Prevent vertical axis rotation in OrbitControls with THREE.js

In my three.js project, I have a scene with OrbitControls that allows me to rotate the camera around the origin at position 0,0,0. I am attempting to restrict the camera rotation to only rotate vertically along the y-axis infinitely (up or down). You can ...

RequestDispatcher.forward() does not work when servlet is invoked through an Ajax POST request

My login page involves user authentication through the firebase and sending the request to a servlet. When I click the submit button with correct credentials, the firebase authentication works, the servlet is called but an error is displayed in the browser ...

Transparent Background Feature in the SoftwareRenderer of Three.js

Experimenting with one of the three.js demos found at Is there a way to create a transparent background? The code snippet provided doesn't seem to work for the SoftwareRenderer, although it works for the WebGLRenderer. However, I specifically need to ...

When working with multiple charts on Angular ChartJs, the data may not display properly

My goal is to display multiple Charts in a single page using Angular. I came across an Example that uses ViewChildren: const baseConfig: Chart.ChartConfiguration = { type: 'pie', options: { responsive: true, } }; @ViewChildren('c ...

Should the header include individual CSS and JS files, or should all code be contained within a single CSS and JS file?

As I work on optimizing my website, I find myself juggling multiple plugins that include jQuery plugins with CSS along with my own JavaScript code. Currently, the CSS is spread across separate files for each plugin I have downloaded. When needed on a page ...

Tips for deleting default text from MUI Autocomplete and TextField on click

I am currently using Material-UI (MUI) Autocomplete feature with a TextField element, and I have a specific behavior that I would like to achieve. Currently, when I click on the search bar, the placeholder text moves to the top of the TextField. However, m ...

Tips for attaching to a library function (such as Golden Layout) and invoking extra functionalities

I am currently utilizing a library named Golden Layout that includes a function called destroy, which closes all application windows on window close or refresh. My requirement is to enhance the functionality of the destroy function by also removing all lo ...

What is the process of creating multiple entities in Three.js?

I am struggling to create a scenario where multiple objects fall from the top in my project. My attempt at duplicating the code has not been successful. Below is the code snippet I have been working on: var renderer = new THREE.WebGLRenderer({canvas: doc ...

Arranging routes in node.js like a pro

const express = require('express'); const router = express.Router(); router.use(function(req, res, next){ console.log(req.user) if(!req.user){ res.redirect('/login'); }else{ res.locals.username = req.user.us ...

Connect the drawer state in Vuetify when the navigation drawer and app bar are separate components

Currently, my Dashboard consists of two components: Dashboard <template> <v-app> <Toolbar :drawer="app.drawer"></Toolbar> <Sidebar :drawer="app.drawer"></Sidebar> </v-app> </template> ...

Tips for preventing a promise from being executed more than once within an observable while being subscribed to a BehaviorSubject

I've defined a class called Store with the following structure: import { BehaviorSubject, Observable } from 'rxjs' export abstract class Store<T> { private state: BehaviorSubject<T> = new BehaviorSubject((undefined as unknown ...

One way to incorporate type annotations into your onChange and onClick functions in TypeScript when working with React is by specifying the expected

Recently, I created a component type Properties = { label: string, autoFocus: boolean, onClick: (e: React.ClickEvent<HTMLInputElement>) => void, onChange: (e: React.ChangeEvent<HTMLInputElement>) => void } const InputField = ({ h ...

Execute a function with parameters when a button is clicked dynamically using PHP

I am trying to execute a parameterised function in PHP using AJAX. Below is the code snippet of my dynamic button where I need to pass $sub_id to the delet(sub_id) function for executing some SQL: echo "<td><input type='submit' name=&a ...

I am encountering an error message that states "Uncaught TypeError: Cannot read property 'use' of undefined."

https://i.sstatic.net/HcwYr.png Error: Unable to access the 'use' property of an undefined object ...

Issue with Facebook login on Android from a different device

I have been experimenting with the Facebook login integration on Android using the SessionLoginSample. It is functioning properly on my device, but when I try it on other phones, the pop-up appears but nothing happens when I click OK. It should redirect ...