Authentication methods
| Method | Use case | Token lifetime |
|---|---|---|
| OAuth 2.0 Client Credentials | Server-to-server integrations, automated systems | 15 minutes |
| JWT Bearer Token | User-initiated actions, interactive applications | 15 minutes (access), 7 days (refresh) |
OAuth 2.0 (recommended)
OAuth 2.0 Client Credentials flow is designed for machine-to-machine communication where no user interaction is required.Step 1: Create an OAuth client
OAuth clients are created in the LinkXG application by an Owner or Admin.- Go to Account > API Access
- Select Create OAuth Client
- Provide a name for the client (e.g., “ERP Integration”)
- Select the scopes you need
- Save the client
client_id and client_secret. Store the secret securely — it is shown only once.
Step 2: Request an access token
Exchange your credentials for an access token:Step 3: Use the token
Include the token in theAuthorization header of all API requests:
Available scopes
| Scope | Description |
|---|---|
products:read | Read products and product versions |
products:write | Create, update, and delete products |
connections:read | Read connections and shared data |
connections:write | Manage connections |
imports:write | Bulk import operations |
traceability:read | Read traceability and supply chain data |
dpp:read | Read Digital Product Passports |
Rotating client secrets
If your client secret is compromised, rotate it immediately:JWT authentication (user context)
JWT authentication is used when actions need to be performed in the context of a specific user, typically for interactive applications.Login
Using the token
Include the access token in requests:Refreshing tokens
Access tokens expire after 15 minutes. Use the refresh token to obtain a new access token:Logout
Invalidate your session:Token handling best practices
Store tokens securely. Never store tokens in client-side code, localStorage, or version control. Use secure server-side storage or environment variables. Refresh proactively. Request a new token before the current one expires. A token that expires mid-request will fail. Handle 401 errors gracefully. If you receive a 401 Unauthorized response, your token may have expired. Refresh it and retry the request. Use the minimum necessary scope. Tokens with broader scopes carry greater risk. Request only what you need. Rotate secrets regularly. Even without a suspected compromise, rotating client secrets periodically reduces risk.Error responses
Authentication errors return standard HTTP status codes:| Status | Error | Description |
|---|---|---|
| 400 | invalid_request | Malformed request (missing fields, invalid format) |
| 401 | invalid_client | Client credentials are incorrect |
| 401 | invalid_token | Token is expired, malformed, or revoked |
| 403 | insufficient_scope | Token does not have the required scope |
| 429 | rate_limit_exceeded | Too many authentication requests |

