The Google Apps Script binding for the Firebase Realtime Database
Best it to copy the content of this file in your Google Apps Script project: https://github.com/RomainVialard/FirebaseApp/blob/master/src/Code.gs
You can also add it as a library, though this is not recommended.
https://developers.google.com/apps-script/guides/libraries
Library's script ID: 1VlYLzhwx0YEoxIe62eItLAZeobVt_l-GQUKt2MXXuBHFVsqBkl9C_yBB
Retrieves a database by url
- Parameters:
-
url
—string
— - the database url -
[optSecret]
—string
— - a Firebase app secret
-
- Returns:
Database
— the Database found at the given URL
Returns a valid Firebase key from a given string Firebase Keys can't contain any of the following characters: . $ # [ ] / https://firebase.google.com/docs/database/usage/limits#data_tree https://groups.google.com/forum/#!msg/firebase-talk/vtX8lfxxShk/skzA5vQFdosJ
-
Parameters:
string
—string
— - the string to encode -
Returns:
string
— the encoded string
Returns a decoded string from a Firebase key encoded by encodeAsFirebaseKey()
-
Parameters:
string
—string
— - the encoded Firebase key -
Returns:
string
— the decoded string
Signs in or signs up a user using credentials from an Identity Provider (IdP) - eg: google.com. https://cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithIdp
- Parameters:
-
firebaseConfig
—object
— - see the "Get config object for your web app" section in the page linked below. -
idToken
—string
— - an OpenID Connect identity token retrieved via ScriptApp.getIdentityToken()
-
- Returns:
object
— the auth token granting access to firebase
Generates an authorization token to firebase
- Parameters:
userEmail
—string
— the email account of the user you want to authenticateoptAuthData
—object
— key-pairs of data to be associated to this user.serviceAccountEmail
—string
— the email of the service account used to generate this tokenprivateKey
—string
— the private key of this service account
- Returns:
object
— the auth token granting access to firebase
Generates an authorization token to Firebase
- Parameters:
-
userEmail
—string
— - the email account of the user you want to authenticate -
optCustomClaims
—object
— - key-pairs of data to be associated to this user (aka custom claims).
-
- Returns:
object
— the auth token granting access to firebase
Generates an authorization token to firebase
- Parameters:
userEmail
—string
— the email account of the user you want to authenticateoptCustomClaims
—object
— - key-pairs of data to be associated to this user (aka custom claims).
- Returns:
object
— the auth token granting access to firebase
Returns the data at this path
- Parameters:
-
path
—string
— - the path where the data is stored -
[optQueryParameters]
—OptQueryParameters
— - a set of query parameters
-
- Returns:
object
— the data found at the given path
Returns data in all specified paths
-
Parameters:
{Array.<string
— FirebaseApp_.request>} requests - array of requests -
Returns:
object
— responses to each requests
Generates a new child location using a unique key
- Parameters:
-
path
—string
— - the path where to create a new child -
data
—object
— - the data to be written at the generated location -
[optQueryParameters]
—OptQueryParameters
— - a set of query parameters
-
- Returns:
string
— the child name of the new data that was added
Write data at the specified path
- Parameters:
-
path
—string
— - the path where to write data -
data
—object
— - the data to be written at the specified path -
[optQueryParameters]
—OptQueryParameters
— - a set of query parameters
-
- Returns:
object
— the data written
Update specific children at the specified path without overwriting existing data
- Parameters:
-
path
—string
— - the path where to update data -
data
—object
— - the children to overwrite -
[optQueryParameters]
—OptQueryParameters
— a - set of query parameters
-
- Returns:
object
— the data written
Delete data at the specified path
- Parameters:
-
path
—string
— - the path where to delete data -
[optQueryParameters]
—OptQueryParameters
— - a set of query parameters
-
- Returns:
null
—
Gets the absolute URL from the specified path
- Parameters:
path
—string
— - the path / location to convert to URL - Returns:
string
— an encoded URL that is ready to be put into a browser
#Tutorials https://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase/tutorials