This repository was archived by the owner on Jul 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Examples
Олег Морозов edited this page Feb 12, 2018
·
6 revisions
Create Firebase instance
local fb = require('firebase'):new('my-project')Auth with legacy Firebase database token
fb.auth:auth_legacy('pei6phah4oow9Uloosai0aiheD2IXoo4eiC0Aik7')Auth with user email
fb.auth:auth_legacy('Yohph5choh2iePeig4chiephooleegae2Shaetoo', 'project-user@gmail.com', 'oHaheiv8', true)Auth with service account file
fb.auth:auth_service_account('my-project-firebase-adminsdk-ohhe6-peudiquoo2.json')Get all users
local users = fb.database:read('/users')Get all users with sort by first name
local users = fb.database:read('/users', { orderBy = 'first_name' })Get users with 'Tom' as first name
local users = fb.database:read('/users', { orderBy = 'first_name', equalTo = 'Tom' })Print users id, first name, avatar filename, download avatar file and remove bad user
for id, user in pairs(users) do
if user.last_name == 'Hardy' then
fb.database:remove(string.format('/users/%s', id))
else
print(id, user.first_name, user.avatar)
fb.storage:download('/' .. user.avatar, string.format('avatars/&s.jpg', id))
end
end