[英]Facebook graph api can't get user public profile
I've implemented social authentication in my application, and I get the accesstoken successfully. 我已经在我的应用程序中实现了社交身份验证,并且成功获得了访问令牌。 But when I use that access token to get the user's public profile, I get only the user's ID and the user's name. 但是,当我使用该访问令牌获取用户的公开个人资料时,只会得到用户的ID和用户名。 I can't get the other properties of the user like the user's profile picture. 我无法获得用户的其他属性,例如用户的个人资料图片。
when I try this: 当我尝试这个:
Json = await httpClient.GetStringAsync($"https://graph.facebook.com/v5.0/{userWithOnlyId.Id}?access_token={accessToken}");
I get only the user's id and name. 我只得到用户的ID和名称。
when I do this as stated in this facebook doc : 当我按照此facebook文档中所述进行操作时 :
await httpClient.GetStringAsync(
$"https://graph.facebook.com/me?fields=profile_pic&access_token={accessToken}");
I get a 403 forbidden error. 我收到403禁止错误。
Is there something I did wrong ? 我做错了什么吗? I've tried several things I found here on stackoverflow but up till now I have no solution. 我已经尝试了一些在stackoverflow上找到的东西,但是直到现在我还没有解决方案。
There is an example(section: Retrieving a Person's Profile): 有一个示例(部分:检索个人资料):
https://graph.facebook.com/<PSID>?fields=first_name,last_name,profile_pic&access_token=<PAGE_ACCESS_TOKEN>
Looks like you need to provide a PSID 看来您需要提供一个PSID
ASID(App-scoped ID) - it's a user-id that is unique for each app. ASID(应用程序作用域ID)-这是每个应用程序唯一的用户ID。
It means that this user will have different ASID for each app. 这意味着该用户将为每个应用程序使用不同的ASID。 I think that you have only one app. 我认为您只有一个应用程序。
To get a Page-scoped ID from an App-scoped ID, send a POST request to the /pages_id_mapping root node 要从应用程序范围的ID获取页面范围的ID,请将POST请求发送到/ pages_id_mapping根节点
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.