Partners can call editor URL with their Tokens passing it to the auth query parameter instead of passing apiKey directly .
The tokens can be generated via the below APIs. These tokens can be generated first against our back-end.
1: generatetoken endpoint
POST
First, you need to generate token, In the body, you can pass multiple param and value which you were passing as a query parameter
Generate token endpoint
POST :
Code Block |
---|
tokens.dev.graebert.com/generate |
headersHeader :
Code Block |
---|
Content-type:application/json, x-api- |
...
key: apiKey |
Body :
Code Block |
---|
{
"auth" : "apiKey",
"file" : "filePath",
"userId" : "userId",
"server": "serverId",
"param": "value"
} |
Result :
On successful, it will give 200 status code
Code Block |
---|
status: 200 Ok
{
"token": "bbf18f21-3d0d-4a4c-b650-9c14d4075ce0",
"expiration_time": 1595917409
} |
On error, it will give 403 error code like below
Code Block |
---|
status: 403 Forbidden
{
Wrong token
} |
Validate token and get all param and valued stored for that token
To validate the token, we have another endpoint API, in which you have to pass token on header. on success , it will return all param and values stored for that token
GET:
Code Block |
---|
https://tokens.dev.graebert.com/ |
...
verify |
headersHeader :
Code Block |
---|
Content-type:application/json, |
...
x-api-token: |
...
apiToken |
resultResult :
Code Block |
---|
Status: 200 OK { |
...
"auth" : "apiKey",
"file" : "filePath",
"userId" : "userId",
"server": "serverId",
"param": "value"
} |
On error, it will give 403 error code like below
Code Block |
---|
status: 403 Forbidden { Wrong token } |