代码之家  ›  专栏  ›  技术社区  ›  moondaisy

请求Facebook个人资料图片和其他信息

  •  0
  • moondaisy  · 技术社区  · 6 年前

    我正在使用js-SDK,在用户使用FB登录后,我想请求电子邮件、名字、姓氏和图片(图片链接)。

    FB.api('/me?fields=email,first_name,last_name',
      (graph_response) ->
        ...
    )
    

    这也可以,但我得到的图片是超小的(如果我要求的话,也是一样的) type=square /me/picture ):

    FB.api('/me?fields=email,first_name,last_name,picture',
      (graph_response) ->
        ...
    )
    

    FB.api('/me/picture?type=large&redirect=false',
      (graph_response) ->
        ...
    )
    

    有没有一种方法可以在一个请求中将两者结合起来?我试过了 /me?fields=email,first_name,last_name,picture&type=large 运气不好。

    0 回复  |  直到 6 年前
        1
  •  1
  •   andyrandy    6 年前

    这是有效的:

    /me?fields=email,first_name,last_name,picture.type(large)
    

    或者,可以指定尺寸:

    /me?fields=email,first_name,last_name,picture.width(100).height(100)
    

    更多信息: https://stackoverflow.com/a/27006154/757508