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    

Quickstart

1. Set up your Xkit Platform

  • Sign up for a free Xkit developer account.
  • Set the Website origin and Login redirect URL for your application (see the Configure Xkit documentation for more information)

2. Generate an API Key

Follow the API Key guide for instructions on how to generate a publishable and secret API key.

3. Connect apps

Follow the Connecting with Apps guide for more specific instructions.

4. Create contexts and get Xkit Tokens

During your authentication process, or anywhere in the request/response lifecycle that you have access to an authenticated user, provision them for access to Xkit with one API call: Create Context.

Check out the Authenticating Users as Contexts Guide for a more in-depth example.

5. Install xkit.js on your front-end

Add the script tag below anywhere in your rendered HTML to load a customized version of xkit.js onto the page:

<script src="https://<your-slug>.xkit.co/xkit.js"></script>

6. Log your users into Xkit

When you create a context, Xkit will return an access_token that you can use to log them into Xkit on the front-end of your application using xkit.js.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>My App</title>
  </head>
  <body>
    <script src="https://<your-slug>.xkit.co/xkit.js"></script>     
    <script>
        xkit.ready(() => xkit.login(async () => {
        const token = await retrieveXkitTokenFromBackend()
        return token
      }))
    </script>
  </body>
</html>

Check out the Authenticating Users as Contexts Guide for a more in-depth example.

7. Retrieve an access token

You can use the Get Connection by Slug endpoint to retrieve access tokens for connected apps.

app.post("/share-to-slack", async (req, res) => {
  const {
    connection,
    connector,
    authorization
  } = await axios({
    baseUrl: 'https://app.xkit.co/api/platform',
    url: `/contexts/${req.user.id}/connections/slack`,
    auth: {
      username: PUBLISHABLE_KEY,
      password: SECRET_KEY
    }
  })
  
    if (!connection.enabled || authorization.status !== 'active') {
    throw new Error('User has not authorized Slack')
  }
  
  const slackToken = authorization.access_credential
  
  // ... post to Slack with the Slack API
})

See the Retrieving Access Tokens guide for more information.

Updated 2 months ago

Quickstart


Suggested Edits are limited on API Reference Pages

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