Check token
Verify a CI HUB access token and read the current user envelope.
Verifies that a CI HUB access token is still valid and returns the user profile envelope the partner platform needs to display in its UI. Typical use: confirm an active session before rendering a CI HUB-backed view, or revalidate after a long idle period.
licenseState, licenseExpires, and isTrialLicense describe the SDK
subscription, not the DAM provider. They are informational; the SDK subscription
itself is re-checked on every call.
A 401 here is the cue to start a new exchange. A 402 means the subscription state changed: contact CI HUB before retrying.
Authorization
CIHubAuth The CI-HUB JWT token obtained through authentication. Needs to be sent in the Authorization header.
In: header
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/auth/checkToken"{
"adapter": "CI HUB",
"source": "api.ci-hub.com",
"user": "Jane Doe",
"account": "jane@customer.example.com",
"licenseState": "Subscription",
"licenseExpires": 1798761599999,
"isTrialLicense": false,
"userHash": "a1b2c3d4e5f6g7h8i9j0k1l2"
}{
"message": "Error",
"details": "POST /api/v1/auth/exchangeToken failed: SDK authentication token is invalid",
"errorCode": "cihub-sdk-token-invalid",
"error": {
"code": "integration-forbidden",
"source": "cihub",
"status": 400,
"message": "Access denied by the integration",
"details": "403 Forbidden - insufficient_permissions",
"provider": "bynder"
}
}{
"message": "Error",
"details": "POST /api/v1/auth/exchangeToken failed: SDK authentication token is invalid",
"errorCode": "cihub-sdk-token-invalid",
"error": {
"code": "integration-forbidden",
"source": "cihub",
"status": 400,
"message": "Access denied by the integration",
"details": "403 Forbidden - insufficient_permissions",
"provider": "bynder"
}
}{
"message": "Error",
"details": "POST /api/v1/auth/exchangeToken failed: SDK authentication token is invalid",
"errorCode": "cihub-sdk-token-invalid",
"error": {
"code": "integration-forbidden",
"source": "cihub",
"status": 400,
"message": "Access denied by the integration",
"details": "403 Forbidden - insufficient_permissions",
"provider": "bynder"
}
}{
"message": "Error",
"details": "POST /api/v1/auth/exchangeToken failed: SDK authentication token is invalid",
"errorCode": "cihub-sdk-token-invalid",
"error": {
"code": "integration-forbidden",
"source": "cihub",
"status": 400,
"message": "Access denied by the integration",
"details": "403 Forbidden - insufficient_permissions",
"provider": "bynder"
}
}Example
import { CiHubAccessClient, TokenManager } from '@ci-hub/access-sdk'
const client = new CiHubAccessClient({ baseUrl: 'https://stage.ci-hub.com/api/v1' })
const tokens = new TokenManager(client) // seeded during authentication
const profile = await tokens.withCihubAuth((accessToken) => client.checkToken(accessToken))curl "https://stage.ci-hub.com/api/v1/auth/checkToken" \
-H "Authorization: Bearer $CI_HUB_ACCESS_TOKEN"const response = await fetch(
'https://stage.ci-hub.com/api/v1/auth/checkToken',
{ headers: { Authorization: `Bearer ${ciHubAccessToken}` } }
)
if (!response.ok) {
const { error } = await response.json()
throw new Error(`${error.code}: ${error.message}`)
}
const profile = await response.json()