Question

i am working on a problem here. I want to add any person who visits my website to a closed group on facebook. For this i have create an app and asked for permissions but even after it show status = connected the app is not inviting users and returns an #3 OAuthException. I am doing this using javascript SDK only.

Here is the snippet of my javascript code file which i created by following this link .

(function(d) {
        var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
        if (d.getElementById(id)) {return;  }
            js = d.createElement('script');
            js.id = id; js.async = true;
            js.src = "//connect.facebook.net/en_US/all.js";
            ref.parentNode.insertBefore(js, ref);
        }(document));

  window.fbAsyncInit = function() {
  FB.init({
      appId      : 'APP_ID',                        
      status     : true,
      xfbml      : true
    });


  FB.login(function(response) {
      var accessToken = response.authResponse.accessToken;
      FB.api('/GROUP_ID/members'+response.authResponse.userID, 'post', {"access_token": accessToken}, function(response) {
          console.log(response);
      });
  }, {scope: 'user_groups,friends_groups'});

As you guys marked my answer as duplicate, i am editing my question from here. Please at least confirm that, if you guys are sure that inviting a user to a group is not possible. I already visited that link which is mentioned. It says that inviting a user to a group is not possible, but according to the developer's document it is said that :-

Applications can invite users to a group by issuing a POST request to /GROUP_ID/members/USER_ID with an app access_token.

Note that user being invited must be a user of the application. The user will be sent a notification saying that they have been invited to the group. The notification will take them to the group page.

So kindly reply, if you have any idea about it. Thanks a lot.

Was it helpful?

Solution

App and Game Groups is currently in Beta

refer to: https://developers.facebook.com/docs/reference/api/app-game-groups/

  1. User must already be authorized to inviting app.
  2. Application Access Token must be used for invites.

Applications can invite users to a group by issuing a POST request to /GROUP_ID/members/USER_ID with an app access_token.

Note that user being invited must be a user of the application. The user will be sent a notification saying that they have been invited to the group. The notification will take them to the group page. Users can only be invited once. Subsequent invites will fail.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top