How to access admin.auth()?
See original GitHub issueIs it even possible to access the admin object from the migration script?
I want to change some filed names inside customUserClaims
, so I thought it would be nice to create a migration for that. But for doing that I would need to access admin.auth().listUsers()
and then run setCustomUserClaims()
for each individual user.
I’ve added const admin = require("firebase-admin");
before the script, which amazingly worked, but that feels like a workaround and not a proper solution.
I would suggest adding admin
object to MigrateOptions
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Introduction to the Admin Auth API | Firebase Authentication
The Firebase Admin SDK provides an API for managing your Firebase users with elevated privileges. The admin user management API gives you the...
Read more >Introduction to the Admin Auth API - Identity Platform
The Firebase Admin SDK lets you set custom attributes on user accounts. With custom user claims, you can give users different levels of...
Read more >Build a Role-based API with Firebase Authentication - Toptal
Firebase allows you to get quickly up and running with an enterprise-level auth API, which you can extend later on. · Almost every...
Read more >How to use the firebase-admin.auth function in firebase-admin
url : undefined, email: user.email, }; let loginUid; try { if (linkedAccountUid) { await admin.auth().updateUser(linkedAccountUid ...
Read more >Firebase Admin SDK to Log user in from Server - Stack Overflow
There is a method on the firebase admin SDK to get the user info by Email admin.auth().getUserByEmail(email) . This method returns all the ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi. In my case, the fireway
app.auth()
(v1.0.2) was failing using emulator even with--forceWait
as suggested by @dsvgit (even with the--dryRun
switch). I was getting the following errorI end up configuring my env using these two variables:
Local migration using ‘app.auth’ works properly with the emulator now !
app
property which is provided by fireway seems like works for me--dryrun
option doesn’t work for auth updates (only for firestore)--forceWait
option to make it works