如何在 Ionic 应用程序中允许来自 facebook cdn 的图像?
How to allow images from facebook cdn in Ionic app?
我突然无法在我的 Ionic 1 应用程序(使用 Facebook 提供商的 Firebase 身份验证)中加载来自 Facebook (https://scontent.xx.fbcdn.net) 的个人资料图片。这以前有效,但现在我只得到一张空白图像(可能是某种 4xx 错误代码?)。 iOS 和 Android.
我安装了 cordova-plugin-whitelist
,我的 config.xml
安装了 <access origin="*"/>
。
我尝试添加 content-security-policy
元标记,但没有成功:
<meta http-equiv="Content-Security-Policy" content="img-src * blob: android-webview-video-poster: cdvphotolibrary: 'self' data: ws: wss://*; default-src * blob: 'self' gap: wss: ws: data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * http: https: ws: wss://*;">
有什么想法吗?我知道这以前有效,所以 Cordova 或 iOS/Android 中可能有一些变化导致了这个?
谢谢!
更新:
我尝试使用其他外部图像,例如报纸上的随机图像,并且我成功了。这可能是某种 Facebook 身份验证错误吗?
ionic info
--------------------------------
--------------------------------
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.2
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
ios-deploy version: 1.8.6
ios-sim version: 5.0.6
OS: Mac OS X Sierra
Node Version: v4.4.0
Xcode version: Xcode 8.3.1 Build version 8E1000a
我通过手动获取个人资料图片设法解决了这个问题。 Firebase SDK提供的图片还是不行。
var user = firebase.auth().currentUser;
if (user != null) {
user.providerData.forEach(function (profile) {
if (profile.providerId === "facebook.com") {
user.updateProfile({
photoURL : "https://graph.facebook.com/" + profile.uid + "/picture?height=200"
});
}
});
}
我突然无法在我的 Ionic 1 应用程序(使用 Facebook 提供商的 Firebase 身份验证)中加载来自 Facebook (https://scontent.xx.fbcdn.net) 的个人资料图片。这以前有效,但现在我只得到一张空白图像(可能是某种 4xx 错误代码?)。 iOS 和 Android.
我安装了 cordova-plugin-whitelist
,我的 config.xml
安装了 <access origin="*"/>
。
我尝试添加 content-security-policy
元标记,但没有成功:
<meta http-equiv="Content-Security-Policy" content="img-src * blob: android-webview-video-poster: cdvphotolibrary: 'self' data: ws: wss://*; default-src * blob: 'self' gap: wss: ws: data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * http: https: ws: wss://*;">
有什么想法吗?我知道这以前有效,所以 Cordova 或 iOS/Android 中可能有一些变化导致了这个?
谢谢!
更新:
我尝试使用其他外部图像,例如报纸上的随机图像,并且我成功了。这可能是某种 Facebook 身份验证错误吗?
ionic info
--------------------------------
--------------------------------
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.2
Ionic CLI Version: 2.1.1
Ionic App Lib Version: 2.1.1
ios-deploy version: 1.8.6
ios-sim version: 5.0.6
OS: Mac OS X Sierra
Node Version: v4.4.0
Xcode version: Xcode 8.3.1 Build version 8E1000a
我通过手动获取个人资料图片设法解决了这个问题。 Firebase SDK提供的图片还是不行。
var user = firebase.auth().currentUser;
if (user != null) {
user.providerData.forEach(function (profile) {
if (profile.providerId === "facebook.com") {
user.updateProfile({
photoURL : "https://graph.facebook.com/" + profile.uid + "/picture?height=200"
});
}
});
}