0

I want to write a java (spring controller) where i can receive callback url sent by facebook whenever a user de-authorizes my app.

I have specified the correct URL in my app and have read the documentation provided on fb. But i don't know how to write a controller file. I have tried this.

@Controller
public class RemoveAppController {

    private static Logger log = LoggerFactory.getLogger(RemoveAppController.class);

    @RequestMapping(value="/deauthorizehandler.htm", method=RequestMethod.POST)
    public void removeApp(HttpServletRequest request) throws Exception {
       log.info("DeAuthorize Callback getting successfully");
    }
}

Am i somewhere wrong ? Because this controller is not getting executed. URL i have specified in my app is http://localhost:8080/server/deauthorizehandler.html which i have mapped.server is running fine. Please help.

Lina Clark
  • 243
  • 4
  • 9
  • I assume the difference between .htm and .html is a typo, right? – Luciano Mar 06 '12 at 13:11
  • Yeah...this thing is correct in code.This is actually html – Lina Clark Mar 06 '12 at 13:13
  • Can you elaborate what happens on server and client when you make a POST request to the controller URL from an internal and external IPs? Also which version of Spring are you using? – Alex Mar 06 '12 at 15:40
  • If you access the url directly then it will be a GET request and in your controller you dont have any mapping for the GET method. You only have mapping for POST method. You can try changing that to GET and check. Also please check the spring context xml's which takes care of scanning the packages for its annotations. – raddykrish Mar 06 '12 at 16:00
  • I replaced the POST to GET and then i checked from browser.. In browser,my url was http://localhost:8080/server/deauthorizehandler.html Then in console, my method was sucessfully logged i.e. DeAuthorize Callback getting successfully.. – Lina Clark Mar 10 '12 at 08:42
  • Can someone tell me what are the settings to be saved in facebook app so that facebook pings the above mentioned url with post method. May be because of the settings i have set in my app settings i ma not getting callback. So please tell me what should be settings there ? – Lina Clark Mar 12 '12 at 06:27

1 Answers1

0

I have got the answer, Running Facebook application on localhost

We can not use localhost for receiving deauthorize callback. Quite a simple concept and I missed it..

Community
  • 1
  • 1
Lina Clark
  • 243
  • 4
  • 9