标签: firebase-authentication

Firebase reauthenticateAndRetrieveDataWithCredential 问题

方法reauthenticateAndRetrieveDataWithCredential需要credential.

我试过这个,它给了我一个错误:

const user = firebase.auth().currentUser;
const credential = firebase.auth.OAuthCredential;
await user.reauthenticateAndRetrieveDataWithCredential(credential);
await user.updateEmail(email);
return email;
Run Code Online (Sandbox Code Playgroud)

错误信息

reauthenticateAndRetrieveDataWithCredential 失败:第一个参数“凭据”必须是有效凭据。

我只有宣誓认证(没有电子邮件+密码)。所以我无法弄清楚credentialfirebase 需要什么。有什么帮助吗?

编辑: 出于某种原因,我的firebase.auth.OAuthCredential或 ( firebase.auth.AuthCredential) 返回未定义。用户已登录/授权。

javascript firebase firebase-authentication

1
推荐指数
1
解决办法
2686
查看次数

如何在 Flutter 中使用 Firebase 更改密码

我想在 Flutter 中使用 Firebase 更改当前用户密码。任何人都可以帮助我如何实施更改密码方法吗?

dart firebase firebase-authentication flutter

1
推荐指数
3
解决办法
1万
查看次数

无法解决:com.google.firebase:firebase-messaging:16.0.5

如何解决这个错误!

“无法解决:com.google.firebase:firebase-messaging:16.0.5”

Firebase 依赖版本是16.0.5,我也切换并玩了一些其他版本,仍然有错误。

  def Firebase_version = "16.0.5"
        implementation "com.google.firebase:firebase-auth:$Firebase_version"
        implementation "com.google.firebase:firebase-messaging:$Firebase_version"
Run Code Online (Sandbox Code Playgroud)

我正在使用最新版本的类路径

 classpath 'com.android.tools.build:gradle:3.2.1'
 classpath 'com.google.gms:google-services:4.0.2'
Run Code Online (Sandbox Code Playgroud)

和存储库

google()
jcenter()
Run Code Online (Sandbox Code Playgroud)

两者都添加:

安卓工作室:3.2.1

android firebase build.gradle firebase-authentication firebase-cloud-messaging

1
推荐指数
1
解决办法
9373
查看次数

从 VueJs 应用程序上传图像到 Firebase

我想允许用户在同一事件中注册并上传图像,因此姓名和电子邮件等数据将进入 firestore,图像将进入存储桶,目前,我能够实现这两个功能,但分开,所以我有点坚持是如何将数据和图像链接在一起,以便我以后可以检索它们。我也想使用 Vuex 完成这项工作。下面的代码解释了我如何将数据和图像分别从我的 .vue 组件发送到 firestore 和 storage

import { storage } from '../firebase/init.js'
import firebase from 'firebase'

export default {
  data(){
    return {
        email: '',
        password: '',
        image: null
      }
    }, 
    methods: {
      signUp(){
        firebase.auth().createUserWithEmailAndPassword(this.email, this.password)
           .then(response => {
             let user = {
             id: response.user.id,
             email: response.user.email
           }
          //here i want to do something to link this user to the upload image event below
        })
      },
      uploadFile(e){
        const file = e.target.files[0];
        
        storage.ref('images/'+ file.name).put(file)
          .then(response => {
            console.log(response)
          }) …
Run Code Online (Sandbox Code Playgroud)

firebase vue.js firebase-authentication vuex google-cloud-firestore

1
推荐指数
1
解决办法
6331
查看次数

发布应用程序后 Firebase 身份验证失败

我正在使用 2 个谷歌帐户和 2 个不同的 firebase 项目来开发和发布 android 应用程序。我已经在他们两个上实施了谷歌身份验证。当我有构建时,两者都运行良好。即 Dev 还执行身份验证和发布构建。当我在 Google Play Console 上发布我的应用程序并通过 Play 商店下载它时,Google 身份验证失败。它给出错误“登录已取消!RC:0

android firebase firebase-authentication

1
推荐指数
1
解决办法
997
查看次数

Firebase 身份验证与云 sql 混合

我正在使用 firebase auth 和 Google App Engine 开发我的第一个应用程序,我想知道我应该如何做一些事情。

例如:我的架构将在 Google App 引擎中,我使用 Cloud SQL 来存储数据(使用 sequelize)。该应用程序是使用 node.js 和 express 开发的。

问题是我想使用 firebase auth 来简化登录。

一切都是在客户端完成的,所以......有没有关于我应该如何使用 firebase Auth 以及我应该如何对我的 API 的请求进行身份验证以便在每个请求中获得哪个用户的示例?

也许将令牌转发给 API?然后获取信息?

谢谢你的帮助。

google-app-engine node.js google-cloud-sql firebase firebase-authentication

1
推荐指数
1
解决办法
1098
查看次数

Firebase 身份验证预期 `onClick` 侦听器是一个函数,而是获得了一个 `object` 类型的值

在我的 React 项目上设置 Firebase 身份验证期间。我无法在按钮单击时触发 Auth Pop up。

要么在单击按钮后在控制台内引发错误,要么在刷新页面后自动打开身份验证(预期onClick侦听器是一个函数,而不是一个object类型的值。)

// Initialize Firebase
import firebase from "firebase/app";
import "firebase/firestore";
import "firebase/auth";
const config = {
  apiKey: "myKeyHere",
  authDomain: "domain",
  databaseURL: "url",
  projectId: "idb",
  storageBucket: "bucket",
  messagingSenderId: "id"
};
firebase.initializeApp(config);
export const firestore = firebase.firestore();
export const auth = firebase.auth();

export const provider = new firebase.auth.GoogleAuthProvider();
export const signInWithGoogle = () => auth.signInWithPopup(provider);

const settings = { timestampsInSnapshots: true };
firestore.settings(settings);

export default firebase;
Run Code Online (Sandbox Code Playgroud)

这是我的组件:

import React, { …
Run Code Online (Sandbox Code Playgroud)

authentication firebase reactjs firebase-authentication

1
推荐指数
1
解决办法
358
查看次数

是否为 Firebase 身份验证启用 CICP 活动日志记录活动?

我的项目使用 Firebase 身份验证。

我想为合规性启用身份验证活动的日志记录。Google 为其 Google Cloud CICP(客户和合作伙伴的云身份)提供了此功能(此处文档)。

我知道 CICP 说它与 Firebase 身份验证兼容,但这是否意味着如果我启用它,它会记录我的 Firebase 项目的身份验证活动?或者它只会记录来自 CICP 直接创建的帐户的活动?谢谢!

firebase google-cloud-platform firebase-authentication

1
推荐指数
1
解决办法
142
查看次数

Firebase 异步任务到协程

我使用挂起例程构建器使 Firebase 任务从基于异步侦听器的代码转移到基于协程的代码。

这是我的 suspendcoroutine,通过它我实现了协程行为。

suspend fun <T> Task<T>.awaitTask(): T =
    suspendCoroutine { continuation ->
        addOnCompleteListener { task ->
            if (task.isSuccessful) {
                continuation.resume(task.result!!)//what to do if task.result is null
            } else {
                continuation.resumeWithException(task.exception!!)
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

这就是我调用它的方式

firebase.createUserWithEmailAndPassword(userCredentials.email!!, userCredentials.password!!).awaitTask()
Run Code Online (Sandbox Code Playgroud)

一切正常,直到我们执行一个可能为空结果的任务。喜欢 。

firebase.currentUser?.updateProfile(profileUpdates)?.awaitTask()
Run Code Online (Sandbox Code Playgroud)

这里在成功更新后,task.result 为空。在那种情况下,应该将什么传递给 continuation.resume?。

android kotlin firebase-authentication kotlin-coroutines

1
推荐指数
1
解决办法
1337
查看次数

Flutter Firebase Auth:如何在 Flutter Drawer 中显示用户电子邮件和姓名

我已成功从 Firebase Auth 检索到用户电子邮件和名称。但我想在 Flutter Drawer 中显示它

姓名和电子邮件检索:

    Future<FirebaseUser> _handleSignIn() async {
  final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
  final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

  final AuthCredential credential = GoogleAuthProvider.getCredential(
    accessToken: googleAuth.accessToken,
    idToken: googleAuth.idToken,
  );

  final FirebaseUser user = await _auth.signInWithCredential(credential);
  print("signed in " + user.displayName);
  print("signed in " + user.email);
  return user;
}
Run Code Online (Sandbox Code Playgroud)

颤动抽屉:

drawer: new Drawer(
    elevation: 10.0,
    child: new ListView(
      children: <Widget>[
        new UserAccountsDrawerHeader(
          accountName: new Text("Name"), //I want to display user NAME here
          accountEmail: new Text("Email"), //display …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication flutter

1
推荐指数
1
解决办法
5372
查看次数