Setup Firebase Realtime SDK Project
Updated 363 Days AgoPublic

  • Obtain Google account
  • Open Firebase console: https://console.firebase.google.com/
  • Log in with Google credentials.
  • "Create new project" - I would recommend to apply some naming convention and use postfix "-dev", "-qa" and "-prod" respectively.
  • Open permissions ("Settings" gear "Overview" menu item)
  • "Service Accounts"
  • "Create Service Account"
    • Provide name, select role "Project > Editor"
    • Check "Furnish a new private key"

  • Store JSON document in a secure place. *Do not put on app's web dir or any publicly accessible place!* For yaas-tools, this `yaas-sso` module requires the credentials to issue OpenID tokens (blog post will follow).
  • Go back to console main screen, open "Database" view and note database URL (in our case: `https://yaas-sculptor-dev.firebaseio.com/` )
  • Go to "Settings > Project Settings" and note Web API Key.
  • Update DB URL and Web API Key,
On YAAS-SSO authentication and DB settings are unified in a `yaas-sso-<env>.json` like this:
{
  "type": "service_account",
  "project_id": "yaas-scul***",
  "private_key_id": "2928c0***",
  "private_key": "-----BEGIN PRIVATE KEY-----***\n",
  "client_email": "yaas-sso@***",
  "client_id": "112***",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/***.iam.gserviceaccount.com",

  "databaseURL": "https://yaas-sc***.firebaseio.com"
}
  • Install, if not already done, firebase cli
  • On prompt, login: firebase login. Webbrowser access required to log you into your account!
  • firebase use <<YourProjectName>>
  • firebase deploy - this will upload database security rules as defined in databases.rules.json (referenced from `firebase.json`)
Tryout via node sso.js --env=dev and requesting a token exchange via CURL shows the expected result.

*to be continued w/ OAuth2 setup*

Last Author
whein
Projects
None
Subscribers
whein