[Facebook Connector] Getting user token to get profile picture

Forge Component
(10)
Published on 2018-12-04 by OutSystems R&D
10 votes
Published on 2018-12-04 by OutSystems R&D

We are using Facebook conector, and one of the things we do is use the facebook profile picture of the user, as his profile picture in our platform.

To do that we use an external url where we pass the user facebookid  that is saved in our database, and that looks like this:

https://graph.facebook.com/v6.0/109355004052876/picture

But we realised that for some users, to be able to get the picture we also need in some situations to give a user token. As you can see from this response.

 "error": {
    "message": "An access token is required to request this resource.",
    "type": "OAuthException",
    "code": 104,
    "fbtrace_id": "AR1EnBmJ9jIN0DmKrGoymHE"
  }
}


this is how the URL should be:

https://graph.facebook.com/v6.0/109355004052876/picture?redirect=false&access_token={user_token}

But we weren't able to figure out where with facebook connector we get this token that doesn't expire.

Bruno Monteiro wrote:

Bruno when you do the login, the profile picture is returned, in this action you can get it



Use this structure: