Firebase Action Transform for Hasura

Firebase is a popular suite of tools and services for starting projects quickly in the Google Cloud. Many startups begin there journey with Firebase and as such, have many user accounts still authenticating with Firebase, even after migrating to other tools for the the rest of their stack.

This integration allows you to create new user accounts, and authenticate users with email and password.

An example mutation to create a user:

mutation {
  firebase_signup(
    params: { email: "[email protected]", password: "safe-password" }
  ) {
    idToken
    refreshToken
    expiresIn
    localId
    email
  }
}

An example mutation to authenticate a user:

mutation {
  firebase_signin(
    params: { email: "[email protected]", password: "safe-password" }
  ) {
    idToken
    refreshToken
    expiresIn
    localId
    email
    registered
  }
}

Configuring an Action Transform

You'll need the following environment variables.

 FIREBASE_API_BASE: https://identitytoolkit.googleapis.com/v1

Additionally, you'll need your Web API key which you can find from your key settings page available /settings/general from your main console. You'll provide this as a query parameter. The Environment variable can be added along with the rest of your Hasura GraphQL Engine settings, but the API key will need to be added as a query parameter value for the action itself.

Firebase API Key Firebase API Key

Importing an Action Transform

Importing actions and events into Hasura apply one or more actions. Actions based on request configurations and will need metadata to be applied. Events need underlying table structure to trigger the events.

Steps required for this integration:

  • Metadata Apply

Metatadata Apply

To apply metadata into your project. You will need:

  1. The Hasura CLI installed.
  2. Run "hasura metadata apply" from the root folder of your Hasura metadata project. In this project, you can find that folder under /hasura.

More information about Hasura CLI can be found in the documentation.

SPECS
Released: December 14, 2021
Developed by: Hasura
Category: Auth