Suggestions

close search

Account REST API Authentication

REST API for project, number management ... must be authenticated using a custom HTTP header: X-STRINGEE-AUTH or URL Parameter: access_token along with a JSON web token.

You need Account SID and Account Key to create access_token (get Account SID and Account Key here https://developer.stringee.com/account/setting)

Create the JWT token (access_token) with format:

HEADER:
    {
        "typ": "JWT",
        "alg": "HS256",// only support HS256
        "cty": "stringee-api;v=1"
    }

PAYLOAD:
    {
        "jti": "AC...-...",//JWT ID
        "iss": "AC...",//Account SID
        "exp": ...,//expiration time
        "rest_api": true
    }

VERIFY SIGNATURE:
    HMACSHA256(
        base64UrlEncode(HEADER) + "." +
        base64UrlEncode(PAYLOAD),
        accountKey
    )

The values:

    iss: Account SID on Stringee 
    jti: the identify of the token, can be generated by: accountSid_timestamp
    exp: the expired time of the token (in second)
    accountKey: Account key is a secret key of Stringee account

Sample request using X-STRINGEE-AUTH header:

POST /v1/project HTTP/1.1
Host: https://api.stringee.com
X-STRINGEE-AUTH: YOUR_ACCESS_TOKEN
Accept: application/json

{
    ...
}

Sample request using URL Parameter:

POST /v1/project?access_token=YOUR_ACCESS_TOKEN HTTP/1.1
Host: https://api.stringee.com
Accept: application/json

{
    ...
}