I wish to allow an anonymous user login to a Firebase Function.
Like so :
firebase.auth().signInAnonymously().catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
});
From : https://firebase.google.com/docs/auth/web/anonymous-auth
The thing is, I don't know what the firebase object is.
What is the import statement I should use to get this firebase object ?
I've tried the following :
const firebase = require('firebase-app');
const firebase = require('firebase');
const firebase = require('firebase-admin');
Nothing seems to have the auth().signInAnonymously() property.
I get errors like TypeError: firebase.auth is not a function or admin.auth(...).onAuthStateChanged is not a function in the Function log.
This is the function I want to call : https://firebase.google.cn/docs/reference/js/firebase.auth.Auth#signinanonymously
And this is the firebase object I want to import : https://firebase.google.cn/docs/reference/js/firebase
Error: Cannot find the firebase namespace; be sure to include firebase-app.js before this library.when trying to do the firebase deploy - krisauthfunction should exist onconst firebase = require('firebase-admin');- Nenroznode.js. If you're running in the browser, please indicate that by telling us what browser you're running when getting the error. - Heretic Monkey