How to get FB User ID using Facebook Login Button in android application

前端 未结 8 2509
鱼传尺愫
鱼传尺愫 2021-02-05 21:51

I\'m developing an application in which I\'m using Facebook log in button from SDK. I\'m able to get access_token of the user but I want userID

8条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-05 22:32

    The Facebook graph API lets you make calls that return JSON, which you can parse in Android with a JSONObject like this below code.

    JSONObject me = new JSONObject(fb.request("me"));
    String id = me.getString("id");
    

提交回复
热议问题