Skip to content

wrong code #399

@AdamTeodoro

Description

@AdamTeodoro

Github documentation page:

// These samples are intended for Web so this import would normally be
// done in HTML however using modules here is more convenient for
// ensuring sample correctness offline.
import firebase from "firebase/app";
import "firebase/auth";
function setPersistenceSession() {
var email = "...";
var password = "...";
// [START auth_set_persistence_session]
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION)
.then(() => {
// Existing and future Auth states are now persisted in the current
// session only. Closing the window would clear any existing state even
// if a user forgets to sign out.
// ...
// New sign-in will be persisted with session persistence.
return firebase.auth().signInWithEmailAndPassword(email, password);
})
.catch((error) => {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
});
// [END auth_set_persistence_session]
}

Firebase documentation page:

https://firebase.google.com/docs/auth/web/auth-state-persistence?hl=pt-br#web_1

wrong imports: ❌

import firebase from "firebase/app";
import "firebase/auth";

correctly imports: ✅

import firebase from "firebase/compat/app"; // Or the modular import
import "firebase/compat/auth"; // Or the modular import for getAuth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions