Skip to main content

Authenticating your requests

Retrieve an OAuth 2.0 Bearer access token with the client credentials OAuth flow.

Retrieving a Bearer access token requires a ChatKitty application client ID and client secret.

You can create a ChatKitty application and receive client credentials using the ChatKitty dashboard.

ChatKitty expects a valid Bearer access token to be included in all API requests like this:

Authorization: Bearer {{access_token}}

You must replace {{access_token}} with an access token gotten using your client credentials.

To authorize use this replacing CLIENT-ID with your client ID and CLIENT-SECRET with your client secret:

curl --location --request POST 'https://authorization.chatkitty.com/oauth/token' \
--user 'CLIENT-ID:CLIENT-SECRET' \
--form 'grant_type=client_credentials'
const oauthTokenResults = await fetch(
"https://authorization.chatkitty.com/oauth/token",
{
body: new URLSearchParams({
grant_type: "client_credentials"
}),
headers: {
Authorization: `Basic ${Buffer.from(
`${process.env.CHATKITTY_OAUTH_CLIENT_ID}:${process.env.CHATKITTY_OAUTH_CLIENT_SECRET}`
).toString("base64")}`,
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST"
}
)

Returns a JSON response with the Bearer access token.

{
"access_token": "af6ad86d-0b48-4b35-8157-f1510533be8e",
"token_type": "bearer",
"expires_in": 43199,
"scope": "create:* read:* update:* delete:*"
}

access_token is the bearer access token. expires_in represents the access token's validity in seconds.