Skip to content

Open API

Erupt supports external systems obtaining a token via appid + secret to call Erupt endpoints without requiring a user login.

INFO

APPID and Secret are managed in the UPMS → Open API menu, corresponding to the EruptOpenApi entity class. View the Open API Management →

WARNING

At any given time, each APPID can only have one valid token. Calling the token generation endpoint again will immediately invalidate the previous token. For security, call this endpoint from the backend service to avoid exposing the secret to the frontend.

1. Enable Distributed Session

Tokens generated by Open API depend on Redis Session. Enable it in the configuration file:

yaml
erupt:
  redis-session: true

spring:
  redis:
    database: 0
    timeout: 10000
    host: 127.0.0.1

2. Get a Token

http
GET {{host}}/erupt-api/open-api/create-token?appid=xxx&secret=xxx

Response example:

json
{
  "token": "xxxxxxx",
  "expireTime": "20xx-01-01"
}
FieldDescription
tokenAccess token for subsequent API calls
expireTimeToken expiration time

3. Call Erupt Endpoints

After obtaining the token, include it in the request header to call protected endpoints:

http
GET {{host}}/erupt-api/your-api
token: xxxxxxx

For information on using endpoint permission annotations, refer to API Development & Operation Logs.

Contributors

The avatar of contributor named as YuePeng YuePeng

Changelog

Released under the Apache-2.0 License.