我在我的Windows PC上使用离子制作了一个应用程序,现在当切换到mac时我从控制台收到此错误
"拒绝加载 https://lorem.firebaseio.com/.lp?start=t&ser=59502592&cb=11&v=5, 因为它没有出现在Content Security的script-src指令中".
我已经尝试在我的标题中修改我的CSP标签,我似乎无法让它工作.我也尝试重新添加所有插件/平台/资源.
我现在使用的标签是
<meta http-equiv="Content-Security-Policy" content="default-src * data: cdvfile: gap:; style-src 'self' https://cdn.firebase.com https://*.firebaseio.com https://lorem.firebaseio.com/*; script-src 'self' 'unsafe-eval'">
Run Code Online (Sandbox Code Playgroud)
我也想知道为什么我不能像过去那样将它添加到我的白名单插件中
<allow-navigation href="*"/>
<allow-navigation href="http://192.168.178.13:8100"/>
<allow-intent href="*.firebaseio.com"/>
<allow-intent href="auth.firebase.com"/>
Run Code Online (Sandbox Code Playgroud)
----------------------------- edit -------------------- ---------
为了解决我的所有问题,我使用了这3个标签
content="default-src * data: cdvfile: gap:;
style-src 'self' 'unsafe-inline';
img-src 'self' 'unsafe-inline';
script-src 'self' https://lorem.firebaseio.com/*
https://cdn.firebase.com
https://*.firebaseio.com
'unsafe-eval'">
Run Code Online (Sandbox Code Playgroud) cordova content-security-policy ionic-framework firebase-authentication
我使用谷歌云端点(版本1,使用android studio)为我的Android应用程序构建了一个移动后端.我希望通过电子邮件/密码验证我的用户,因此我使用Firebase身份验证来执行此操作.Firebase身份验证sdk允许我在客户端(在android中)获取每个用户的令牌,而firebase管理员sdk允许我检查后端令牌的有效性.我了解在云端点我可以提供自己的自定义身份验证器(请参阅:Google Cloud端点和用户身份验证),我计划在我的自定义身份验证器中调用firebase admin sdk来验证用户的呈现令牌.
我的问题是,因为我使用谷歌云端点来构建我的后端,我不知道在我可以验证任何令牌之前,在哪里插入代码来执行firebase管理对象的初始化.在常规应用程序引擎环境中,您将在HTTPServlet的init()方法中执行此初始化(请参阅https://github.com/GoogleCloudPlatform/firebase-appengine-backend/blob/master/src/main/java/com /google/cloud/solutions/flexenv/backend/MessageProcessorServlet.java),但云端点通过自动提供"SystemServiceServlet"作为HTTPServlet来隐藏此信息.我已经尝试了继承SystemServiceServlet并重写init()方法,但是然后将端点部署到app引擎失败了,因为显然,创建android客户端库要求必须使用SystemServiceServlet(并且必须将其命名为"SystemServiceServlet") ").
我可以在云端点提供的每个api方法中初始化firebase管理应用程序(例如,在我的api的insert方法中),但这看起来效率极低.如何在使用谷歌云端点构建的后端中使用Firebase管理员sdk?
非常感谢你花时间陪伴
google-app-engine android google-cloud-endpoints firebase-authentication firebase-admin
我已经获得了Firebase Web身份验证,并为oAuth以及本地用户名/密码(电子邮件地址)工作.
我的问题是:有没有人知道如何在那里引入一个额外的步骤,以便在完全验证之前必须由站点管理员批准新帐户?我正在考虑调整/利用该user.emailVerified属性,但我认为这对oAuth用户不起作用.
有一种简单的方法可以做到这一点 - 添加管理员批准步骤吗?或者,Firebase身份验证子系统中是否有可以轻松切换的属性?
因此,当您尝试使用其他auth方法登录应用时,例如,首先用户使用Google,现在他使用FB并且这2个帐户拥有相同的邮件,您会收到该错误
auth/email-already-exists
问题是,如果你有3个以上的auth方法,那个错误信息不是非常具体的,开发一个处理这种情况的逻辑可能有点棘手.你是如何解决这个问题的?
javascript authentication node.js firebase firebase-authentication
我正在尝试通过Firebase在我的Android应用中实施Google登录,并且在我的Gradle同步后,以下消息仍然显示:
错误:任务':app:processDebugGoogleServices'的执行失败.请通过更新google-services插件的版本来修复版本冲突(有关最新版本的信息,请访问https://bintray.com/android/android-tools/com.google.gms.google-services/)或将com.google.android.gms的版本更新为10.2.6.
我该如何解决这个错误?
这是我的Gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.sjf.lgcats"
minSdkVersion 15
targetSdkVersion 25
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/2'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-vector-drawable:25.3.1' …Run Code Online (Sandbox Code Playgroud) 我一直在尝试实现Firebase文档中有关如何通过Firebase上的Facebook验证用户的逻辑.但我看起来更关注native android而不是Xamarin.任何人都可以用材料帮助我吗?我已经在网上和论坛上搜索了一些样本.
我有一个使用Firebase的Android应用程序,包含数据库,身份验证和云功能模块.当用户通过应用程序创建配置文件并设置用户全名时,值为
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// user signed in
String displayName = user.getDisplayName();
// do whatever with displayName...
} else {
// ....
}
Run Code Online (Sandbox Code Playgroud)
非常符合预期 - 无论用户投入什么.
我还有一个云功能,它为新用户创建一个数据库记录:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.createUserRecord = functions.auth.user().onCreate(function(event) {
const user = event.data;
const userName = user.displayName || 'Anonymous';
const userSignedUp = (new Date()).toJSON();
console.log('A new user signed up: ', user.uid, userName, userSignedUp);
return admin.database().ref('users').push({
name: `${userName}`,
email: `${user.email}`,
ref: `${user.uid}`,
signup: `${userSignedUp}` …Run Code Online (Sandbox Code Playgroud) 我尝试为我设置的Firebase项目部署一个非常简单的站点,并按照以下步骤操作:
在部署时,我不断收到以下错误消息:
λfirebase部署
!您需要更新CLI身份验证以利用新功能.
!请运行firebase login --reauth
错误:无法授权访问项目[PROJECT NAME]
我成功地运行了firebase login --reauth,我仍然得到了这个.
谁知道我在这里做错了什么?
javascript cmd firebase firebase-hosting firebase-authentication
嗨,我已经按照swift的电话号码auth教程进行了操作,这是我的代码:
import UIKit
import FirebaseAuth
class SignInViewController: UIViewController {
@IBOutlet weak var number: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let myColor : UIColor = UIColor.white
number.layer.borderWidth = 2.0
number.layer.borderColor = myColor.cgColor
number.layer.cornerRadius = 15.0
number.attributedPlaceholder = NSAttributedString(string :"Enter your number", attributes : [NSForegroundColorAttributeName : UIColor.white] )
}
@IBAction func sendCode(_ sender: Any){
let alert = UIAlertController(title: "Phone Number", message: "Is this your phone number? \n \(number.text!)", preferredStyle: .alert)
let action = UIAlertAction(title: "Yes", style: .default) {(UIAlertAction) in
PhoneAuthProvider.provider().verifyPhoneNumber(self.number.text!){ (verificationID, error) …Run Code Online (Sandbox Code Playgroud) 我发现很难将登录逻辑与注册逻辑分开,因为firebase只有一种方法可以通过Facebook验证用户:signIn(with: AuthCredential).这一种方法将登录现有用户,或者如果它们尚不存在则自动注册,因此我无法知道用户是否第一次注册,因此我可以保留其他信息firebase数据库中的用户.
非常感谢任何帮助解决这个问题.我的应用程序是用Swift编写的,所以任何带代码的解决方案在Swift中都会有所帮助.谢谢
查看回调内的评论
private func rx_firebaseLogin(with credential: AuthCredential, userInfo: [String: AnyObject]) -> Observable<[String: AnyObject]> {
return Observable<[String: AnyObject]>.create { observable in
Auth.auth().signIn(with: credential) { (user, error) in
// IF user is already authenticated, User will get signed in automatically.
// IF user is new, that user will automatically get signed up.
// So I cannot put code here to save user info in db because I could potentially just be signing in a user, and end up …Run Code Online (Sandbox Code Playgroud)