Sonolus Wiki

POST /sonolus/authenticate

/sonolus/authenticate allows Sonolus app to establish an authentication session.

URL Parameters

None.

Query Parameters

Query ParameterValueDescription
localizationstringSee localization.

Request Headers

HeaderValueDescription
Sonolus-SignaturestringSee Sonolus-Signature.

Request Body

type AuthenticateServerRequest = {
    type: 'authenticateServer'
    address: string
    time: number
    userProfile: UserProfile
}

Server should verify that request body is authentic using Sonolus-Signature request header.

type

Server should verify that type equals to 'authenticateServer'.

address

Server should verify that address matches server address.

time

Server should verify that time is recent.

Response Code

CodeDescription
200 OK
401 UnauthorizedAuthentication rejected.

Response Headers

HeaderValueDescription
Sonolus-VersionstringOptional, see Sonolus-Version.

Response Body

type AuthenticateServerResponse = {
    session: string
    expiration: number
}

session

Server defined session information.

expiration

Session expiration time, in Unix timestamp in milliseconds.

Session should be short lived, recommended 30 minutes or less. Once expired, Sonolus app will initiate re-authentication process automatically.

Examples

{
    "session": "...",
    "expiration": 1640995200000
}