Get Access Token interface
Before accessing the API, you need to obtain the AccessToken first, and all other interface calls need to add the token in the Header for permission verification.
Request URL:
http://wallet.unn.com:8080/v2/access_token/create
Request method: POST
Request parameters:
parameter | type | required | description |
---|---|---|---|
address | string | true | ETH address |
type | string | true | login method, signature |
signature | string | true | signature information |
timestamp | int | true | timestamp of signature message |
Signature instructions
Get the current timestamp (precision seconds)
Splicing together with "employee-login-" into a string
Use the sha256 algorithm to convert the string to a 32-byte hexadecimal string
Use the private key to sign the string
request example
curl --location 'http://wallet.unn.com:8080/v2/access_token/create' \
--header 'Content-Type: application/json' \
--data '{
"body": {
"address": "0xA56aA8b7F3Fb0413dA417527C9b0C939C80244E9",
"type": "signature",
"signature": "0x81b32c670e1468472e256579d989f691d2f80a7987cff3134fcf5ace8d12325a17b078fbd65890026c20e822cea4061d29b46b9f833ff3325d4d3e32792de6051b",
"timestamp": 1695263348
}
}'
Return parameters:
parameter name | type | description |
---|---|---|
id | string | employee ID, if it is the business owner, this field is empty |
token | string | token |
employee_info | Array | Information about the company the employee belongs to |
--chain | string | network ERC20/TRC20 |
--contract_addr | string | enterprise wallet contract address |
--enterprise | string | enterprise ID |
--is_owner | bool | Is the owner |
--permission | Array | Permissions owned by this employee 2-Audit |
--id | string | employee ID |
return example
{
"code": 200,
"message": "success",
"data": {
"entity": {
"id": "64214d77cc557604809a238c",
"token": "service.eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMHg4N2YyNTA4MUU3RGNEZUZDYzA1NUZGMjhkNzVjOTYxNURjNDUwMEJDIiwiY29tcGFueV9uYW1lI jpbeyJjaGFpbiI6IkVSQzIwIiwiY29udHJhY3RfYWRkciI6IjB4YkFjNzJiN0NjRDMzYmNDNzNlNTk2YkRBQTMxOGY2ODJFOTNFQkFiMCIsImVudGVycHJpc2UiOiIweDM2NGQ5NWQyRWQ3ZT gyZDg4NGUwMjhlYTZkODYxMDBEMjVDZDVBMjciLCJpc19vd25lciI6ZmFsc2UsInBlcm1pc3Npb24iOlsxXSwiaWQiOiI2NDIxNGQ3N2NjNTU3NjA0ODA5YTIzOGMifV0sImNyZWF0ZVRpb WUiOjE2ODAyMjk1MTcsImV4cCI6MTY4MjgyMTUxNywiYWNjb3VudF9uYW1lIjoiIn0.vaKR_PBCfZx7sXahgHhAFV-OzeQKCqSwsfkffuG2dq8",
"employee_info": [
{
"chain": "ERC20",
"contract_addr": "0xbAc72b7CcD33bcC73e596bDAA318f682E93EBAb0",
"enterprise": "0x364d95d2Ed7e82d884e028ea6d86100D25Cd5A27",
"is_owner": false,
"permission": [1],
"id": "64214d77cc557604809a238c"
}
]
}
}
}