Authentication
To interact with the Kigo API, a partner authenticates requests with bearer session tokens. This guide describes the session types, how to obtain a partner-level session token, and how to handle expiration.
Session Types
| Session | How it is created | Lifetime | Where it may be used |
|---|---|---|---|
| Partner-level session token | Create a session token with your Partner ID and API key | 1 hour | Your servers only |
| User-level session token | Create account session with a partner-level token | 1 hour, plus a refresh token valid 365 days | Your servers and the member's client |
| Anonymous session token | Create an anonymous session, before a member is signed in | 24 hours | Client |
| SSO session ID | See Creating an SSO Session | See the SSO guide | Client (exchanged for a signed-in session) |
Each endpoint's reference page lists the token it requires. User-level tokens are covered in User-Level Authentication.
Prerequisites
Kigo provides each partner with:
- Partner ID: A UUID that identifies your organization.
- API Key: A secret key for your organization.
A partner can obtain these values from their primary contacts at Kigo. Separate credentials are issued for the test and production environments.
Steps to Implement
-
Create a Partner-Level Session Token
- Endpoint: Create a session token
- Purpose: Authorizes partner-level endpoints, such as creating a user-level session token or an SSO session.
- Token Expiration: 1 hour. There is no refresh for partner-level tokens; create a new one when it expires.
curl -X POST https://api.kigodigital.net/api/v1/auth/sessions \ -H "Content-Type: application/json" \ -d '{ "partner_id": "<your partner id>", "api_key": "<your api key>" }'{ "token": "<partner-level session token>" }An unknown
partner_idor incorrectapi_keyreturns400witherror_codeinvalid_input. -
Use the Partner-Level Session Token
- Header Example:
Authorization: Bearer <partner-level session token>
- Header Example:
Key Considerations
- Handling Token Expiration: Partner-level session tokens expire after 1 hour. To maintain uninterrupted access to the API:
- Token Renewal: Reuse the token across requests and create a new one before it expires.
- Error Handling: A request with an expired or invalid partner-level token returns
401witherror_codeauthorization_error. Request a new token and retry the request.
Example Workflow
- Obtain a partner-level session token with your Partner ID and API key.
- Include the partner-level token in API requests to partner-level endpoints.
- Renew the token before it expires to ensure continuous API access.
Best Practices for Authorization
- Secure Storage: Store the API key, Partner ID, and partner-level session tokens securely. Avoid hardcoding credentials in application code; use environment variables or a secrets vault. Never pass the API key or a partner-level session token to front-end clients.
- HTTPS Only: Always make API requests over HTTPS to ensure that tokens and other sensitive data are encrypted in transit.
Updated 2 days ago
Did this page help you?