---
agentTools:
  projectIndex: https://docs.xkit.co/llms.txt
---

# Quickstart

### 1. Set up your Xkit Platform

* [Sign up](https://app.xkit.co/sign-up) for a free Xkit developer account.
* Set the Website origin and Login redirect URL for your application (see the [Configure Xkit](https://docs.xkit.co/docs/configure-xkit) documentation for more information)

### 2. Generate an API Key

Follow the [API Key guide](https://docs.xkit.co/docs/authentication-guide#generate-an-api-key) for instructions on how to generate a publishable and secret API key.

### 3. Connect apps

Follow the [Connecting with Apps](https://docs.xkit.co/docs/connecting-with-apps-overview) 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](https://docs.xkit.co/reference/create-context).

Check out the [Authenticating Users as Contexts Guide](https://docs.xkit.co/docs/xkit-contexts) 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:

[block:code]
{
  "codes": [
    {
      "code": "<script src=\"https://<your-slug>.xkit.co/xkit.js\"></script>",
      "language": "html",
      "name": null
    }
  ]
}
[/block]

### 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.

[block:code]
{
  "codes": [
    {
      "code": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\">\n    <title>My App</title>\n  </head>\n  <body>\n    <script src=\"https://<your-slug>.xkit.co/xkit.js\"></script>  \t\n    <script>\n    \txkit.ready(() => xkit.login(async () => {\n        const token = await retrieveXkitTokenFromBackend()\n        return token\n      }))\n    </script>\n  </body>\n</html>",
      "language": "html",
      "name": null
    }
  ]
}
[/block]

Check out the [Authenticating Users as Contexts Guide](https://docs.xkit.co/docs/xkit-contexts) for a more in-depth example.

### 7. Retrieve an access token

You can use the [Get Connection by Slug](https://docs.xkit.co/reference/get-context-connection-by-slug) endpoint to retrieve access tokens for connected apps.

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

See the [Retrieving Access Tokens](https://docs.xkit.co/docs/retrieving-access-tokens) guide for more information.