如何auth.phoneNumber在Firebase安全规则中使用,例如
auth.phoneNumber == newDatat.phoneNumber
或
auth.provider == phoneNumber
firebase firebase-security firebase-authentication firebase-realtime-database
我只需要向Button内的特定用户发送推送通知即可OnClickListener。userId此特定用户能否获得全部信息?
这是我的Button OnClickListener()代码
richiedi_invito.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
databaseReference = FirebaseDatabase.getInstance().getReference();
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
lista_richieste = (ArrayList) dataSnapshot.child("classi").child(nome).child("lista_richieste").getValue();
verifica_richieste = (String) dataSnapshot.child("classi").child(nome).child("richieste").getValue();
if (!lista_richieste.contains(userID)){
ArrayList lista_invito = new ArrayList();
lista_invito.add(userID);
if (verifica_richieste.equals("null")){
databaseReference.child("classi").child(nome).child("richieste").setValue("not_null");
databaseReference.child("classi").child(nome).child("lista_richieste").setValue(lista_invito);
}
else{
lista_richieste.add(userID);
databaseReference.child("classi").child(nome).child("lista_richieste").setValue(lista_richieste);
}
//invitation code here
Fragment frag_crea_unisciti = new CreaUniscitiFrag();
FragmentManager fragmentManager= getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.fragment_container, frag_crea_unisciti);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
Toast.makeText(getActivity(), "Richiesta di entrare inviata correttamente", …Run Code Online (Sandbox Code Playgroud) java android firebase firebase-authentication firebase-notifications
我目前正在使用Swift开发应用程序,并且已链接Firebase以便用户注册和登录。该应用程序应该是西班牙语的,但我找不到将身份验证错误转换为西班牙语的方法。firebase控制台中是否有启用其他语言或plist中的选项。任何帮助表示赞赏。
所以我一直在尝试设置一个默认的登录系统(当我创建应用程序的其余部分时),所以现在我只想让我的应用程序使用我的凭据进行身份验证(只有1个用户,在开发中),但我不能访问Firebase API要使用的方法.
当我尝试调用该方法时,这就是auto complete所说的
基本上,寻找这样的方法
Auth.auth().signIn(withEmail: email, password: password) { (user, error) in
// code
}
Run Code Online (Sandbox Code Playgroud) 大家好,我正在使用Swift 4制作注册表并使用Firebase。
我一直在重设密码。每当我单击“忘记密码”按钮时,我都会得到一个带有textField的弹出窗口以填写我的电子邮件地址。但是当我点击时,什么也没有发生。在下面发布代码,如果有人有什么想法可能有什么问题
@IBAction func forgotPasswordTapped(_ sender: Any) {
let forgotPasswordAlert = UIAlertController(title: "Forgot password?", message: "Enter email address", preferredStyle: .alert)
forgotPasswordAlert.addTextField { (textField) in
textField.placeholder = "Enter email address"
}
forgotPasswordAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
forgotPasswordAlert.addAction(UIAlertAction(title: "Reset Password", style: .default, handler: { (action) in
let resetEmail = forgotPasswordAlert.textFields?.first?.text
Auth.auth().sendPasswordReset(withEmail: resetEmail!, completion: { (error) in
if error != nil{
let resetFailedAlert = UIAlertController(title: "Reset Failed", message: "Error: \(String(describing: error?.localizedDescription))", preferredStyle: .alert)
resetFailedAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
self.present(resetFailedAlert, animated: …Run Code Online (Sandbox Code Playgroud) 我只是使用Firebase(为iOS和Swift创建)为我的应用创建“重置密码”部分,想知道我是否能够更改发送重置密码链接的电子邮件地址?
例如,我可以将其更改为“ noreply@myappswebsiteurl.com”,而不是“ noreply@appid.firebase.com”吗?
我似乎找不到任何有关如何完成此操作的信息,我想这并不是很重要,但这只是我将来可能要更改的内容。
正确实施后,Firebase电话身份验证会为开发人员提供验证码,必须键入验证码以确认手机。
当您检查verificationIDFirebase提供的内容以及验证码时,您将得到验证并因此登录。
使用此方法,用户可以确认代码并登录:
let credential = PhoneAuthProvider.provider().credential(
withVerificationID: verificationID,
verificationCode: verificationCode)*
PhoneAuthProvider.provider().verifyPhoneNumber(self.phoneNum.text!, uiDelegate: nil) { (verificationID, error) in
UserDefaults.standard.set(verificationID, forKey: "authVID")
}
Run Code Online (Sandbox Code Playgroud)
现在,您需要发送验证码才能登录。
我得到verificationID并保存到UserDefaults。
但是之后,当代码过期时,我将无法继续登录,因为它再次要求我提供另一个验证码。
如何仅使用verificationIDfirebase生成的登录名?
我尝试了该方法:
Auth.auth().signIn(withCustomToken: UserDefaults.standard.string(forKey: "authVID") ?? "")
Run Code Online (Sandbox Code Playgroud)
但是firebase表示身份验证令牌无效。
我不知道我可以使用哪种方法仅使用firebase提供的令牌进行登录。
所以最近我试图使用Facebook登录名登录我的android应用程序。我按照所有说明进行操作(生成密钥,将其放在Facebook等上),但是即使完成所有步骤,我仍然无法登录。
我遇到两个问题:
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { User } from './../classes/user';
import { AlertService } from './alert.service';
import { Alert } from './../classes/alert';
import { AlertType } from './../enums/alert-type.enum';
import { Observable } from 'rxjs';
import 'rxjs/add/Observable/of';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFirestore, AngularFirestoreDocument } from 'angularfire2/firestore';
import 'rxjs/add/operator/switchMap';
import { from } from 'rxjs';
import 'rxjs/add/observable/fromPromise';
import { AngularFireAuthModule } from 'angularfire2/auth';
@Injectable({
providedIn: 'root'
})
export class AuthService …Run Code Online (Sandbox Code Playgroud)我尝试为Flutter项目做工,我有一个用于登录和注销Google帐户的类API,Linter倾向于在使用这些方法(使用Google登录并注销)之前删除静态对象。我无法在视图中调用这些函数。这是我的代码:
API.dart
class FBApi {
FBApi(this.firebaseUser);
...
Future<FBApi> signInWithGoogle() async {
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
...
}
Future<void> signOut() async {
await _auth.signOut().then((_) {
print('***** log out...what the hell?');
_googleSignIn.disconnect();
_googleSignIn.signOut();
// Navigator.of(context).pushNamedAndRemoveUntil("/login", ModalRoute.withName("/home"));
});
}
}
Run Code Online (Sandbox Code Playgroud)
上面的Login.dart错误
Future<bool> _loginUser() async {
final FBApi api = await FBApi.signInWithGoogle();---> error
if (api != null) {
return true;
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
注销.dart
Future<void> _signOut() async {
try {
await FBApi.signOut(); …Run Code Online (Sandbox Code Playgroud) dart firebase firebase-authentication flutter google-cloud-firestore