简体   繁体   English

Facebook图形API无法获取用户公开个人资料

[英]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.

相关问题 Facebook API获取公开资料墙帖子 - Facebook API get public profile wall posts Visual Studio C#Facebook Graph API无法获得用户壁 - Visual Studio C# Facebook Graph API can't get user wall 使用Facebook Graph API(C#.net)无法获取所有用户的个人资料信息 - Unable to get all user's profile info, using Facebook Graph API (C# .net) Facebook Graph API/SDK .NET - 获取 Facebook 用户的 PageID - Facebook Graph API/SDK .NET - Get PageID of a Facebook user 获取用户的公共 email 的方法是什么(C#,Graph API)? - What is the method to get the public email of a User (C#, Graph API)? 使用适用于.NET的Facebook SDK从Facebook的Graph Search API 2.x获得公开帖子 - Get public post from Facebook's Graph Search API 2.x with Facebook SDK for .NET 如何从Facebook Graph Api获取用户电子邮件? - How to get a user email from Facebook Graph Api? 在 microsoft Graph API 中使用“无需用户获取访问权限”方法时如何获取已登录用户的用户配置文件详细信息 - How to get the user profile details of signed in user when 'Get access without a user' method used in microsoft Graph API 构建Facebook应用程序并访问用户个人资料 - Build facebook app and get access to user profile 在Facebook个人资料页面上获取用户信息 - Get user information on the Facebook profile page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM