Ale*_*oJS 6 firebase react-native firebase-authentication
我正在尝试使用Google登录但它却抛出了这个错误:
代码:"auth/operation-not-supported-in-this-environment"消息:"此应用程序运行的环境不支持此操作."location.protocol"必须是http,https或chrome-extension和web必须启用存储."
这是代码:
const provider = new firebase.auth.GoogleAuthProvider();
provider.addScope('profile');
provider.addScope('email');
firebase.auth().signInWithPopup(provider)
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error);
})
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?提前致谢!
首先,我使用react-native-google-signin来使用Google 登录。请按照以下步骤进行配置。
确保正确签署APK(调试或发布)。
从使用它的依赖项中app/build.gradle排除com.google.android.gms,如下所示:
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
Run Code Online (Sandbox Code Playgroud)
然后将您的 Google 令牌与 Firebase 关联:
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 firebase 3.7.1
这就是我的依赖项的样子app/build.gradle
dependencies {
compile project(':react-native-facebook-login')
compile (project(':react-native-fcm')){
exclude group: "com.google.firebase"
}
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
compile(project(":react-native-google-signin")){
exclude group: "com.google.android.gms" // very important
}
compile ('com.google.firebase:firebase-core:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-messaging:10.0.1') {
force = true;
}
compile ('com.google.android.gms:play-services-auth:10.0.1') {
force = true;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8383 次 |
| 最近记录: |