Object returned from Firebase signIn

前端 未结 1 754
谎友^
谎友^ 2020-12-04 00:50

I have two vue projects against Firebase. The first project is created by webpack-simple and the other with just webpack. When calling signInWithEmailAndPassword in the simp

1条回答
  •  心在旅途
    2020-12-04 01:35

    The type of vue.js webpack template (vuejs-templates webpack or webpack-simple) should not have any influence on what return Firebase methods.

    With version 5.0.0 of the Firebase JavaScript SDK (released on May 8, 2018), the return type signature for signInWithEmailAndPassword() has changed: it returns a promise that resolves with a UserCredential (doc) while it used to return a user (doc) in the previous version, see https://firebase.google.com/support/release-notes/js

    Looking at what you get from the signInWithEmailAndPassword() method:

    {"uid": "xxxxx", ....} corresponds to a user object

    and

    {"user": {"uid": "xxxxx", ....}} to a UserCredential object.

    You are probably using two different versions of the SDK in your two projects (one < 5.0.0 and one >= 5.0.0). You can check that in the package.json files.

    0 讨论(0)
提交回复
热议问题