Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.
Олег Морозов edited this page Feb 12, 2018 · 6 revisions

Create Firebase instance

localfb=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

localusers=fb.database:read('/users')

Get all users with sort by first name

localusers=fb.database:read('/users', { orderBy='first_name' })

Get users with 'Tom' as first name

localusers=fb.database:read('/users', { orderBy='first_name', equalTo='Tom' })

Print users id, first name, avatar filename, download avatar file and remove bad user

forid, userinpairs(users) doifuser.last_name=='Hardy' thenfb.database:remove(string.format('/users/%s', id))
elseprint(id, user.first_name, user.avatar)
fb.storage:download('/' ..user.avatar, string.format('avatars/&s.jpg', id))
endend

Clone this wiki locally