skip to Main Content

I am currently using Facebook login for firebase auth for my android app and retriving user’s photourl using

firebaseAuth.getCurrentUser().getPhotoUrl()

This gives me the photo url from the user’s facebook profile.

Recently I have received mail from Facebook stating –
"Facebook will now require client or app access tokens to access a user’s profile picture when querying against user IDs. Beginning on October 24, 2020, queries for profile pictures made against user IDs without an access token will return a generic silhouette rather than a profile picture."
More on it on this link https://developers.facebook.com/blog/post/2020/08/04/Introducing-graph-v8-marketing-api-v8

My question –

Does the request firebaseAuth.getCurrentUser().getPhotoUrl() use access tokens to access url from facebook and will it function the same after the release of Graph API 8.0 on 24th Oct?
Or will I have to make a different query request to fetch the User’s photo url for facebook provider?

3

Answers


  1. Unfortunately, you’ll have to add the access token to the photo url by yourself as Firebase does not and will not support it (as they don’t have access to it – you can read more about it here).

    You’ll have to do something along the lines of:

    firebaseAuth.getCurrentUser().getPhotoUrl() + "?access_token=<facebook_access_token>"
    
    Login or Signup to reply.
  2. To be able to get the access token of facebook, after being logged-in with Firebase, you can use:

    AccessToken.getCurrentAccessToken()

    Complementing the answer of Marek Fort, with Kotlin you can get the picture doing something like that:

    "${firebaseAuth.getCurrentUser().getPhotoUrl()}?access_token=${AccessToken.getCurrentAccessToken()}"
    
    Login or Signup to reply.
  3. In kotlin it looks like:

    "${firebaseAuth.currentUser?.photoUrl}?access_token=${AccessToken.getCurrentAccessToken()?.token}"
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search