I am trying to create a login GET request to the server side using the Firebase cloud functions.
Is it possible to auth using firebase functions? I tried npm i firebase
inside the functions folder, but it fails to work.
Is there an option to create users using server-side code?
Add a memberSign in to Firebase. Click. , then select Permissions. On the Permissions page, click Add member.
Server-side rendering is a technique that allows your React application to serve pages on the server before sending them to the user's browser.
The Firebase Admin SDK should only be run in a privileged environment, like your server or Firebase Cloud Functions. It provides direct administrative access that is not secure on the client.
Start by creating a new app on Retool, and give this app a name. We'll call it “Firebase Admin.” Next, create a Firebase resource by clicking "create a new resource" from the Resource field at the bottom panel. Select Firebase from the options to create a Firebase resource.
To create Firebase Authentication users from within Cloud Functions you use the Firebase Admin SDK for Node.js.
To install it, follow the instructions in the documentation. Mostly it's:
$ npm install firebase-admin --save
And then import it into your index.js using:
var admin = require("firebase-admin");
To create a user follow the instructions in this documentation:
admin.auth().createUser({ email: "[email protected]", emailVerified: false, phoneNumber: "+11234567890", password: "secretPassword", displayName: "John Doe", photoURL: "http://www.example.com/12345678/photo.png", disabled: false }) .then(function(userRecord) { // See the UserRecord reference doc for the contents of userRecord. console.log("Successfully created new user:", userRecord.uid); }) .catch(function(error) { console.log("Error creating new user:", error); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With