嗨2所有人,我使所有喜歡的教程。但是我停止了獲取access_Token。所以這是我的代碼重定向到Facebook。春季社交越來越access_token
@RequestMapping(method = RequestMethod.GET)
public void process(/*
* @ModelAttribute("user") User user, BindingResult
* result Model model,
*/HttpServletRequest request, HttpServletResponse response) {
FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory("240362226072898", "657532dea6d091ab44a56668c47cca15");
OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations();
OAuth2Parameters params = new OAuth2Parameters("http://localhost:8080/shop/facebook");
String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.IMPLICIT_GRANT, params);
try {
response.sendRedirect(authorizeUrl);
LOG.error("ALL WORKING FINE>>>");
} catch (IOException e) {
LOG.error("Errorrrrr" + e);
}
之後在其他控制器。這映射在/臉譜我收到一個URL,但我無法找到任何參數在網址結尾我看到#。像
http://localhost:8080/shop/facebook#access_token=.......&expires_in=6277
如果我剪「#」並粘貼「?」有一切都會好
所以這是我的控制器,我收到這個網址。
@Controller
@RequestMapping(value = "/facebook")
public class FacebookController {
private static final Logger LOG = Logger.getLogger(FacebookController.class);
@RequestMapping(method = RequestMethod.GET)
public void getAuthorisation(@RequestParam String access_token, HttpServletResponse response, HttpServletRequest request) {
LOG.error("Access token"+access_token);
/* LOG.error(request.getAttribute("access_token"));
LOG.error(request.getParameter("access_token"));
*/
}
}
那麼你的問題是什麼? – maksimov
我認爲他正在尋找如何訪問'FacebookController'中的access_token。 –
是的!因爲我無法使用「#」從這樣的URL檢索access_token。它沒有將access_token看作參數。我想問問在控制器中是否存在問題或者可能是一些配置 –