Utility Functions

Firebase.auth_header — Function
auth_header(service=:firestore)

"Authorization" => ... header for a request to service. When that service is pointed at the emulator, the emulator's fixed owner token is used and no OAuth call is made. Any other service, including :management (the Storage management API, which has no emulator), gets a real service-account token, so emulating one service never sends the fake token to a live one.

source
Firebase.get_token — Method
get_token()

Return an OAuth access token for the loaded service account. The token is cached and reused until shortly before it expires, so repeated calls are cheap.

source
Firebase.init — Method
init( julianparseddict::AbstractDict)

Initialize if the sdk key is in Julia dict format.

Example

```md julia> r = HTTP.get(BASE_URL, header); # returns a response with header and body HTTP.Messages.Response

julia> response = JSON.parse(String(r.body)) Dict{String, Any} with 10 entries: "clientemail" => "****" "clientid" => "****" "authuri" => "https://accounts.google.com/o/oauth2/auth" "authproviderx509certurl" => "https://www.googleapis.com/oauth2/v1/certs" "tokenuri" => "https://oauth2.googleapis.com/token" "clientx509certurl" => "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-jk50g%40volka-bot.iam.gserviceaccount.com" "projectid" => "****" "type" => "serviceaccount" "privatekey" => "****" "privatekeyid" => "****"

julia> init(response) ````

source
Firebase.initparsedjson — Method
initparsedjson(jsonstring)

Initialize from a service-account key given as a JSON string, e.g. one read from an environment variable or a secret manager. The key is parsed in memory and never written to disk.

Example

julia> initparsedjson(ENV["FIREBASE_ADMIN_SDK_JSON"])
source