我如何获取access_token然后使用它? [英] How can i get access_token and then use it?

查看:903
本文介绍了我如何获取access_token然后使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中,我希望用户使用其Facebook帐户登录.我是通过重定向网址来实现的.

In my web application i want users to login with their facebook account. I am doing it by redirecting url.

 response.sendRedirect("http://www.facebook.com/dialog/oauth/?scope=email,user_about_me&dispplay=popup&client_id={app_id}&redirect_uri=http://example.com/index.jsp&response_type=token");

在index.jsp上,我正在URL中获得access_token.但是在请求中没有访问令牌.我如何在这里获取访问令牌,然后获取用户电子邮件. index.jsp的url看起来像这样:

At index.jsp i am getting access_token in url. But in request there is no access token. how can i get access token here and then fetch user email. url at index.jsp looks like this:

  http://example.com/index.jsp#access_token={access_token}

谢谢.

推荐答案

我找到了一个教程,它解决了我的问题.以下是该活动的链接:

I found a tutorial and it solved my problem. Following is the link of that turorial:

http://pinoyphp.blogspot.com/2010/12/oath-tutorial-how-to-get-facebook.html#comment-form

这篇关于我如何获取access_token然后使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆