Minting Custom Tokens with the Admin SDK for Node.js - Firecasts

Firebase · 106K views · 2017 · 6:39

Open on YouTube

Web developmentSoftware practice, open source & careersCloud, DevOps & reliabilitytutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about creating custom Firebase auth tokens with the Admin SDK and setting up firebase-admin in Node.

Recommended by 2 people across 2 different months, 2018 to 2021.

What it is

A short Firebase Firecasts episode in which Jen Person shows how to initialize the Firebase Admin SDK for Node.js and mint custom JSON Web Tokens for authentication. It covers setup, npm initialization and generating auth tokens server-side.

What people said

Recommends sarthak · 2018-03 · Stack Overflow · on “Firebase how do i set and retrieve data user vise?”

So when you authenticate your user you create a custom token using firebase admin sdk, pass that token to client and use that to login with firebase. In order to create the token you also pass a uid that you want, this can be uid you use or something else, and you can use that to access firebase features. There is a relevant firecast you probably wanna checkout [this video]

Recommends vitooh · 2020-04 · Stack Overflow · on “How to get documents when authentication is required in the rules”

I don't know the tool you use and what are its capabilities. I found some interesting materials that might be helpful in this case: Tutorial [this video] - this friendly shows the mechanism generally and Node.js implementation. Document [LINK] - here you might find all possibilities to create custom tokens as well on third party tools which I suppose you are using. I hope it will help!

Cites martinomburajr · 2018-02 · Stack Overflow · on “Firebase forgot password- how to identify whether user signed in with email or facebook?”

Try the following. Whenever a user signs up with your platform, be sure to save their basic information e.g. email , name , photoURL , signup/loginType , user-id etc to a database of your choice i.e Firebase Firestore or the Realtime Database(RTD) . So you could have the following Scheme in the RTD for instance: my-app ----users --------user-id-1 ------------name: User 1 ------------email: user1@domain.com ------------loginType:facebook ------------id: user-id-1 --------user-id-2 ------------name: User 2 ------------email: user2@domain.com ------------loginType:email ------------id: user-id-2 ---etc This way if a user claims to have forgotten their password, you can do a quick lookup via ema

Cites Alex Ironside · 2018-09 · Stack Overflow · on “Setup of firebase-admin sdk in javascript file”

My end goal is to get user email, using user's id. So far I figured out I need to use the firebase admin SDK. Right now I have this code: var admin = require("firebase-admin"); var serviceAccount = require("./serviceAccountKey"); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: " [LINK] " }); export default admin; The serviceAccountKey is the file I downloaded from my firebase project here (Sorry it's in Polish) [LINK] I tried using this video as a tutorial/reference [this video] And right now, when I try to do anything I get this in the npm start console: 20:22-48 Critical dependency: the request of a dependency is an expression ./node_modules/google-gax/node

Cites Appurist - Paul W · 2021-01 · Stack Overflow · on “Is there any way to get Firebase Auth User UID?”

This is an old question but I believe the accepted answer provides a correct answer to a different question; and although the answer from Dipanjan Panja [LINK] seems to answer the original question, the original poster clarified later in a reply with a different question: Basically, I need to generate token from UID by Firebase.auth().createCustomToken(UID) to sign in user on firebase with the following function firebase.auth().signInWithCustomToken(token). Because the original question was clarified that the intent is to use createCustomToken and signInWithCustomToken , I believe this is a question about using the Firebase Admin SDK or Firebase Functions (both server-side) to provide custom