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:

KeyValue
Acceptapplication/json
AuthorizationBearer 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

FieldRequiredTypeDescription
client_idYesStringClient ID issued to the Partner. For example: AZN6QUo40w.
client_secretYesStringClient Secret issued to the Partner. For example: C4fFVeFPkISEDQ8acNo9oSHUd8yIGuvoLWJdX9zY.
usernameYesStringEmail of the Shop/Company. For example: hmn.store@gmail.com.
passwordYesStringPassword.
partnerYesStringSecret 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

FieldTypeDescription
token_typeStringToken type. For example: Bearer.
expires_inIntegerExpiration time (seconds) of Access Token. For example: 31536000.
access_tokenStringAccess Token. For example: ZT2PS0pmHPHDKjRu6EMIcoM8rFM8XYHZ1Ye3zRiQ.

Example

{
    "status": "Success",
    "results": {
        "token_type": "Bearer",
        "expires_in": 31536000,
        "access_token": "<Access-Token>"
    }
}
Last Updated: 5/6/2023, 9:45:20 PM