Xkit

The xkit Developer Hub

Welcome to the xkit developer hub. You'll find comprehensive guides and documentation to help you start working with xkit as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Firebase Authentication

Authenticating users with Firebase Authentication

If you use Firebase Authentication to authenticate your users, you can use the same authentication to log users into Xkit to connect other apps to yours.

To set up Firebase Authentication with Xkit, use the following steps:

  1. Click on Settings in the left sidebar and scroll down to "User Tokens"
  2. Click "Add Custom Issuer"
  3. For the "iss Claim", use the value https://securetoken.google.com/<projectId> where <projectId> is your Firebase project ID, the unique identifier for your Firebase project, which can be found in the URL of that project's console.
  4. For the "aud Claim", use the value <projectId> as defined in #3.
  5. For the "User ID Claim", keep it as sub.
  6. For the "JSON Web Key Set URL", use the value https://www.googleapis.com/service_accounts/v1/jwk/[email protected]
  7. Click "Save"

Your Xkit installation will now be able to use your Firebase ID tokens to login to Xkit.

An example usage is below:

import firebase from "firebase/app"
import "firebase/auth"
const config = {
  apiKey: <your API key>,
  authDomain: <your domain>,
};

firebase.initializeApp(config);

firebase.auth().onAuthStateChanged(async (user) => {
  if (user) {
    const token = await user.getIdToken()
    await window.xkit.login(token)
  } else {
    await window.xkit.logout()
});

For more details about this process, check out the Custom Token Issuer Guide on Xkit and the Verify ID Tokens documentation on Firebase.

Updated 2 months ago

Firebase Authentication


Authenticating users with Firebase Authentication

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.