Skip to main content

Using pictureUrl to display profile pic for Facebook auth users

Facebook, Graph APIs, pictureUrl, fbsbx, fbcdn

Jason Liang avatar
Written by Jason Liang
Updated over 3 years ago

When users log in brainCloud with their Facebook credential, brainCloud fetches users' profile picture URLs and save them to users' pictureUrl field by sending a Facebook Graph API with their access token.

For the time being of writing this article, the picture URLs fetched from Facebook are short-lived and temporary CDN URLs, brainCloud has to convert it to a permanent long-lived URL for users.

For example, convert the following temporary short-lived URL:

"https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=111234914143260&height=50&width=50&ext=1648843183&hash=AeSggkNoM83B9Keg1UQ" 

To:

"https://graph.facebook.com/v6.0/111234914143260/picture?"

To use the converted pictureUrl in your app properly, you will need to append app access tokens to it, something like the following,

https://graph.facebook.com/v6.0/111234914143260/picture?access_token=2731168760532562|W7y0BHtK4I5vCcFOzB1P8l8JDhE

You can also append users' access tokens to it if you want to use it with expiration.

https://graph.facebook.com/v6.0/111234914143260/picture?access_token=EAAmzZB8fLDj4BADnbrVjx1ZAsOjzYBtOkeAsGPt5d4wwsk1ZAWTjfLZB405ZCnkZCtS5dpjtRZAFg677DP8EwuDWJXY1SybbGWY9cN69pSPGIhyH4o6UirZCTLOxUwpZByhfmnrpaKX5ZBBo7pxIrt2WPenmLqk8mvidqmPnPrUGaNp5tOUePGasNwRapmgg2amIyeygSOX6myqEQ8uKIEGz2pioQgBnMoGUQpHo09FxFBS46Bg05UUKLf
Did this answer your question?