title: InsufficientPermissionException while publishing on facebook
body: <p>social to integrate my web application with Facebook, now when the user is logged-in in my web application using Facebook login, I am able to read data from his/her profile but whenever I am trying to perform some write operation like <strong>update status</strong> or <strong>publish</strong> a post on user's wall , I am getting an <code>InsufficientPermissionException</code>.</p>
  
  <p>My Login form is:</p>
  
  <pre><code>&lt;form name="fb_signin" id="fb_signin" action="${pageContext.request.contextPath}/auth/facebook"&gt;
     &lt;input type="hidden" name="scope" value="email,publish_stream,read_stream,user_status,user_photos,publish_actions,offline_access" /&gt; 
     &lt;button class="btn btn-facebook" type="submit"&gt; &lt;i class="icon-facebook"&gt;&lt;/i&gt;facebook&lt;/button&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>The required part of config for this operation is:</p>
  
  <pre><code>&lt;bean id="userIdSource" class="org.springframework.social.security.AuthenticationNameUserIdSource"/&gt;
  
  &lt;bean id="facebookApiHelper" class="org.springframework.social.facebook.config.support.FacebookApiHelper"&gt;
      &lt;constructor-arg index="0" ref="usersConnectionRepository"/&gt;
      &lt;constructor-arg index="1" ref="userIdSource"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="connectionFactoryLocator" class="org.springframework.social.security.SocialAuthenticationServiceRegistry"&gt;
      &lt;property name="authenticationServices"&gt;
      &lt;list&gt;
          &lt;bean class="org.springframework.social.facebook.security.FacebookAuthenticationService"&gt;
              &lt;constructor-arg value="${facebook.app.id}" /&gt;
              &lt;constructor-arg value="${facebook.app.secret}" /&gt;
              &lt;!-- Important: The next property name changed from "scope" to "defaultScope" in 1.1.0.M4 --&gt;
              &lt;property name="defaultScope" value="email,publish_actions,publish_stream,read_stream,user_status,user_photos,offline_access" /&gt;               
          &lt;/bean&gt;
      &lt;/list&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>And now my controller is:</p>
  
  <pre><code>public class FacebookOperationController {
  
      private static final Logger logger = LoggerFactory.getLogger(FacebookOperationController.class);
  
      @Autowired
      protected FacebookApiHelper facebookApiHelper;
  
      @Autowired
      UserIdSource userIdSource;
  
      private UsersConnectionRepository usersConnectionRepository;
  
      @Autowired
      public FacebookOperationController(UsersConnectionRepository usersConnectionRepository)
      {
          this.usersConnectionRepository = usersConnectionRepository;
      }
  
      @RequestMapping(method = RequestMethod.GET)
      public String shareWithFacebook(WebRequest request,Model model){
  
          Facebook facebook = facebookApiHelper.getApi();
          Connection&lt;Facebook&gt; connection = usersConnectionRepository.createConnectionRepository(userIdSource.getUserId()).findPrimaryConnection(Facebook.class);
          //connection.updateStatus("hello world");
          MultiValueMap&lt;String, Object&gt; map = new LinkedMultiValueMap&lt;&gt;();
          map.set("link", "www.equinoxrar.com");
          map.set("name", "Hi This is a Test Post");
          map.set("caption", "Link Caption");
          map.set("description", "Loooooo....ng description here");
          map.set("message", "hello world");
  
          // THE BELOW LINES ARE THE CRITICAL PART I WAS LOOKING AT!
          map.set("picture", "http://www.imageRepo.com/resources/test.png"); // the image on the left
          //map.set("actions", "{'name':'myAction', 'link':'http://www.bla.com/action'}"); // custom actions as JSON string
          //String a = facebook.publish(userIdSource.getUserId(), "feed", map);
          String b = connection.getApi().publish(userIdSource.getUserId(), "feed", map);
          //publish(userIdToPostTo, "feed", map);
          return "tilesname";
      }
  }
  </code></pre>
  
  <p>I am able to perform read operation from this Controller but getting an <code>InsufficientPermissionException</code> for any write operation. Can anyone have any idea? The <strong>Exception</strong> I am getting here is:</p>
  
  <pre><code>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.social.InsufficientPermissionException: Insufficient permission for this operation.
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
  </code></pre>