Home Facebook JS SDK, set user as attending event, "(#200) Permissions error" Facebook Graph API
Reply: 0

Facebook JS SDK, set user as attending event, "(#200) Permissions error" Facebook Graph API

LighthouseLukas
1#
LighthouseLukas Published in 2018-02-12 15:46:27Z

I'm trying to create a button that marks a user as attending a Facebook event on their account. I am getting an error about the Permissions.

rsvp 
 {error: {…}}
   error:
   code:200
   fbtrace_id:"AjKCPzoVS0j"
   message: "(#200) Permissions error"
  type: "OAuthException"

I'm using the Graph API Javascript SDK. The function fires when clicking the button "buttton#rsvp":

var fbuserid, fbtoken;
var appid = "359249774550881";
var loggedin = false;

(function($) {
    document.querySelector('button#rsvp').addEventListener( "click", 
    function(){
      FB.api("/321580178346472/attending", "GET", function(r){
        console.log("rsvp", r)
      });
    }, {perms: 'user_event'});
})( jQuery );

FB.init({appId: appid, status: true, cookie: true, xfbml: true});

FB.Event.subscribe('auth.sessionChange', function(response) {
        if (response.session) {
            var session = FB.getSession();
            fbtoken = session.access_token;
            fbuserid = session.uid;
        }
});

FB.getLoginStatus(function(response) {
    if (response.session) {
        var session = FB.getSession();
        fbtoken = session.access_token;
        fbuserid = session.uid;
    }
    else {
        loginFB();
    }
});

function loginFB() {
    FB.login(function(response) {
        if (response.session) {
            var session = FB.getSession();
            fbtoken = session.access_token;
            fbuserid = session.uid;
        }
    });
}

function logoutFB() {
    FB.logout(function(response) {
        // user is now logged out
    });
}

Does anyone know why I am getting this error? Is there some setting I am missing?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.312274 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO