Search code examples
facebookapifacebook-graph-apifacebook-access-tokenaccount-kit

Getting facebook user information using AccountKit access token via Facebook Graph API


I was using access_token from FB AccountKit, but it seems that the access token from facebook account kit are not the same as Facebook's Graph API access token

Output from https://graph.accountkit.com/v1.1/me?access_token=THE_ACCESS_TOKEN shows correctly

"id":    "1581612245187273",
"phone": {
    "number":          "+628979291xxx",
    "country_prefix":  "62",
    "national_number": "8979291xxx",
},

When I use the same id from above as userID and THE_ACCESS_TOKEN as accessToken using Facebook SDK

fb.Get(`/` + userID, fb.Params{
    `fields`:       `name,email,birthday,gender,hometown,languages,location,religion,picture`,
    `access_token`: accessToken,
})

It shows:

"error": {
    "fbtrace_id": "GKBnPt6ZdMm",
    "message":    "Malformed access token",
    "type":       "OAuthException",
    "code":       "190",
},

Is my assumption correct? (that AccountKit access token is not the same as Facebook Graph API token)

How to get the facebook user information when you have only account kit access token? or it's not possible at all?


Solution

  • Account Kit uses a different graph from the Facebook graph and different access tokens. Accounts created with Account Kit are not linked to Facebook accounts. You can use the Account Kit access token to query the Account Kit graph API to find the phone number or email and accountID.