0

I'm trying to access the user profile picture using facebook API and it was working fine until last month. here is my code:

var fbVerifyKeys = _config["Facebook:AppId"] + "|" + _config["Facebook:AppSecret"];

        var verifyTokenResponse = await _httpClient.
            GetAsync($"debug_token?input_token={accessToken}&access_token={fbVerifyKeys}");

        if (!verifyTokenResponse.IsSuccessStatusCode) return Unauthorized();

        var fbUrl = $"me?access_token={accessToken}&fields=name,email,picture.width(100).height(100),id";

        var fbInfo = await _httpClient.GetFromJsonAsync<FacebookDto>(fbUrl);

The URL returned by the API: https://platform-lookaside.fbsbx.com/platform/profilepic/?asid=6228789573841334&height=100&width=100&ext=1701853022&hash=AeTAOgkO4RlWrB0_th8

But this returns 404. I also tried following URL: https://graph.facebook.com/6228789573841334/picture?type=large&redirect=false But this returns Blank user image: enter image description here

3
  • You are getting http error 404 which is not found. Facebook must of changed the webpage and now you must change your code to match the webpage changes. First check if Facebook has a newer API. You are getting Authorize which means you get the token in first request, but the second request is not finding the info on the webpage because something changed. You can go to webpage with any browser and then use the Developer Tools (press 3 dots in upper left of webpage) to examine the webpage to find changes.
    – jdweng
    Nov 6 at 9:48
  • I'm just setting URL to image: <Image src={user?.image || '/assets/user.png'} avatar spaced='right' />. I'm using Facebook Graph API.
    – Saim Sajid
    Nov 6 at 20:47
  • You go to webpage with any browser and right click the image and select copy link address. Then paste into notepad to get url.
    – jdweng
    Nov 6 at 21:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.