抓取用户个人资料图片时 Ionic 2 Native Facebook 插件错误
Ionic 2 Native Facebook Plugin errors when grabbing User profile picture
我的 Ionic 2 应用程序中有一段代码,应该在用户成功登录后获取用户的 Facebook 个人资料。我已验证请求路径 /me
returns 数据与用户关联,但是当我将请求路径设置为 /me/picture
时,出现错误:There was an error making the graph call.
这是我的代码:
if(this.platform.is('cordova')) {
Facebook.login([
'public_profile',
'user_friends',
'email'
]).then((result) => {
Facebook.api('/me?fields=id,name,email,cover', []).then(data => {
// Create the user object
let user = {
access_token: result.authResponse.accessToken,
display_name: data.name,
email: data.email,
facebook_id: data.id,
cover_photo: data.cover.source,
}
Facebook.api(`me/picture`, []).then(data => {
user['profile_photo'] = data.url;
this.loginWithFacebook(user);
}, error => { this.user = JSON.stringify(error)});
})
},
error => {
this.user = JSON.stringify(error);
})
}
我错过了什么吗?我什至尝试过 /{user-id}/picture
但仍然收到错误消息。有人 运行 关注这个问题吗?
By default this edge will return a 302 redirect to the picture image. To get access to the data about the picture, please include redirect=false in your query.
来源:https://developers.facebook.com/docs/graph-api/reference/user/picture/
例如:Facebook.api('me/picture?redirect=false', [])...
我的 Ionic 2 应用程序中有一段代码,应该在用户成功登录后获取用户的 Facebook 个人资料。我已验证请求路径 /me
returns 数据与用户关联,但是当我将请求路径设置为 /me/picture
时,出现错误:There was an error making the graph call.
这是我的代码:
if(this.platform.is('cordova')) {
Facebook.login([
'public_profile',
'user_friends',
'email'
]).then((result) => {
Facebook.api('/me?fields=id,name,email,cover', []).then(data => {
// Create the user object
let user = {
access_token: result.authResponse.accessToken,
display_name: data.name,
email: data.email,
facebook_id: data.id,
cover_photo: data.cover.source,
}
Facebook.api(`me/picture`, []).then(data => {
user['profile_photo'] = data.url;
this.loginWithFacebook(user);
}, error => { this.user = JSON.stringify(error)});
})
},
error => {
this.user = JSON.stringify(error);
})
}
我错过了什么吗?我什至尝试过 /{user-id}/picture
但仍然收到错误消息。有人 运行 关注这个问题吗?
By default this edge will return a 302 redirect to the picture image. To get access to the data about the picture, please include redirect=false in your query.
来源:https://developers.facebook.com/docs/graph-api/reference/user/picture/
例如:Facebook.api('me/picture?redirect=false', [])...