Skip to content

[FR] Documentation on using impersonation with Realtime Database Emulator #1777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
akauppi opened this issue Jun 21, 2022 · 4 comments
Closed

Comments

@akauppi
Copy link

akauppi commented Jun 21, 2022

Is your feature request related to a problem? Please describe.

I'd like to use firebase-admin for testing of Firebase Realtime Database access rules. I'm not sure how to intialize the library, to make it reliably connect to the emulator.

Documentation has Authenticate with limited privileges but the samples it gives are real-world, not emulator URLs.

Describe the solution you'd like

Documentation showing the initialization steps that work with Firebase Realtime Database emulator.

Describe alternatives you've considered

I think I had this code working, but now it fails.

const databaseURL = `http://localhost:6800?ns=demo-2`;

const app = admin.initializeApp({
  databaseURL,
  databaseAuthVariableOverride: { uid },
  projectId
});

Gives (firebase-admin 11.0.0):

Error: Client is offline.

I'll keep looking and post here if I find something that works.


Related:

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@akauppi
Copy link
Author

akauppi commented Jun 21, 2022

This could be a good page for the addition:

https://firebase.google.com/docs/admin/setup

@rhodgkins
Copy link

rhodgkins commented Aug 3, 2022

There's already documentation for properly (using an emulator URL as the databaseURL isn't the "proper" way), and then databaseAuthVariableOverride just works as normal - granted there are some issues related to using the auth variable in the rules, but that what's firebase/firebase-tools#2554 is about.

@akauppi
Copy link
Author

akauppi commented Aug 3, 2022

Thanks, @rhodgkins

I believe this is a duplicate of firebase/firebase-js-sdk#6390 .

@akauppi akauppi closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants