System generated token api
- Here, we can get the token of the API_user and the application_user(database user).
- API user token used to set permission of each API.
- The application user means the end user who will use the application.
Request Method: POST
URL
/api/system-api/user-path/token
Request payload API_user
- Get token of API Maker's API_user.
| {
"authTokenType": "AM",
"authTokenAM": {
"u": "USER_NAME",
"p": "USER_PASSWORD"
}
}
|
Request payload application_user
- Get token of API Maker's database user(application user).
| {
"authTokenType": "AM_DB",
"authTokenAMDB": {
"instance": "INSTANCE_NAME",
"database": "DATABASE_NAME",
"collection": "COLLECTION_NAME",
"usernameColumn": "USER_NAME",
"passwordColumn": "USER_PASSWORD"
}
}
|
Get token using global object 'g'.
- Get Token of API Maker's API_user.
| await g.sys.system.getToken({
"authTokenType": "AM",
"authTokenAM": {
"u": "USER_NAME",
"p": "USER_PASSWORD"
}
});
|
- Get Token of database_user (application user).
| await g.sys.system.getToken({
"authTokenType": "AM_DB",
"authTokenAMDB": {
"instance": "INSTANCE_NAME",
"database": "DATABASE_NAME",
"collection": "COLLECTION_NAME",
"usernameColumn": "USER_NAME",
"passwordColumn": "USER_PASSWORD"
}
});
|
API Response
| {
"success": true,
"statusCode": 200,
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"expires_in": 10800
}
}
|