Authentication
This section helps developers to learn about authentication methods and how to retrieve a token using a username and password.
For requests that require user authentication, the following information must be sent in the Headers:
Key | Value |
---|---|
Accept | application/json |
Authorization | Bearer Access-Token |
Where Access-Token is the user's authentication code.
DID YOU KNOW
Currently, there are 2 ways to get Access-Token, using Personal Access Tokens or Password Grant Tokens.
Personal Access Tokens
View Access-Token in the API section of SuperShip.
NOTE
- This section is for Customers/Partners that want to connect via Personal Access Token, individual customers or partners that only have 1 Shop need to connect.
- Most Customers/Partners use this authentication method.
Password Grant Tokens
This API allows you to get the user's authentication code via email and password.
NOTE
This section is only for E-commerce platforms, software companies with multiple customers who need to connect SuperShip.
Endpoint
post/v1/partner/auth/login
Request
Parameters
Field | Required | Type | Description |
---|---|---|---|
client_id | Yes | String | Client ID issued to the Partner. For example: AZN6QUo40w. |
client_secret | Yes | String | Client Secret issued to the Partner. For example: C4fFVeFPkISEDQ8acNo9oSHUd8yIGuvoLWJdX9zY. |
username | Yes | String | Email of the Shop/Company. For example: hmn.store@gmail.com. |
password | Yes | String | Password. |
partner | Yes | String | Secret Code. For large E-commerce partners with SuperShip. |
Example
curl --request POST \
--url https://api.mysupership.vn/v1/partner/auth/login \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
"client_id": "AZN6QUo40w",
"client_secret": "C4fFVeFPkISEDQ8acNo9oSHUd8yIGuvoLWJdX9zY",
"username": "hmn.store@gmail.com",
"password": "323423",
"partner": "lPxLuxfiTotCyZ1ZnQjMepUL24HLd05ybNBhVGFN"
}'
Response
Returned Result
Field | Type | Description |
---|---|---|
token_type | String | Token type. For example: Bearer. |
expires_in | Integer | Expiration time (seconds) of Access Token. For example: 31536000. |
access_token | String | Access Token. For example: ZT2PS0pmHPHDKjRu6EMIcoM8rFM8XYHZ1Ye3zRiQ. |
Example
{
"status": "Success",
"results": {
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "<Access-Token>"
}
}