开发者

Get Facebook OAuth token from code parameter

开发者 https://www.devze.com 2023-03-10 04:33 出处:网络
I build a FB app which does the following: 1) redirect initial request to FB, in order to authenticate/login, as follows:

I build a FB app which does the following:

1) redirect initial request to FB, in order to authenticate/login, as follows:

https://www.facebook.c开发者_JAVA技巧om/dialog/oauth?client_id=MYAPPID&redirect_uri=http://localhost:8080/FB/servlet&scope=read_stream&response_type=code

2) in servlet, get the "code" parameter (which is the signed_request?):

 String signedReq = request.getParameter("code");

// the String retrieved from the code parameter is:
// 3DaDJXq1Mlsq67GbeudlUxu7bY5Um4hSJlwzoPCHhp4.eyJpdiI6Ikc1ODNuRjZXbnhCb0hUV1FEMVNTQUEifQ._iXKxSGiNHfc-i5fRO35ny6hZ03DcLwu4bpAkslqoZk6OfxW5Uo36HwhUH2Gwm2byPh5rVp2kKCNS6EoPEZJzsqdhZ_MhuUD8WGky1dx5J-qNOUqQK9uNM4HG4ziSgFaAV8mzMGeUeRo8KSL0tcKuq

3) How to get the OAuth token from this String?

Thanks in advance! M


On the facebook docs it tells you to send it back to facebook:

http://developers.facebook.com/docs/authentication/

Basically you do this:

   https://graph.facebook.com/oauth/access_token?
   client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&
   client_secret=YOUR_APP_SECRET&code=THE_CODE_FROM_ABOVE

This should work for you normally.

0

精彩评论

暂无评论...
验证码 换一张
取 消