The following javascript code works with the appearance of the facebook login window and allows the user to log in. The response values are captured, and I know that it works when warnings appear during installation, but I cannot pass the value back to the controller method.
@RequestMapping(value ="/getAccessToken" , method = RequestMethod.POST) public @ResponseBody String getAccessToken(@RequestBody String token){ System.out.println(token); return token; }
Javascript method:
function doLogin() { FB.login(function(response) { alert(response); console.log(response); if (response.authResponse) { alert(response.authResponse.userID); alert(response.authResponse.accessToken); var Token = response.authResponse.accessToken; alert(Token); $.ajax({ type: "POST", url: "/HelloController/getAccessToken", data: Token, success: function (result) { alert("Token"); }, error: function (result) { alert("oops"); } }); document.getElementById('loginBtn').style. display = 'none'; getUserData(); }}, {perms:'manage_pages', scope: 'email,public_profile', return_scopes: true}); };
The error I am getting is the following:
WARN 25660 --- [nio-8080-exec-9] osweb.servlet.PageNotFound : Request method 'POST' not supported
Rate the answers.
source share