Sonolus Wiki

POST /sonolus/authenticate

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

URL Parameters

None.

Query Parameters

Query ParameterValueDescription
localizationstringSee localization.
Configuration OptionsanySee Options Query Parameters.

Request Headers

HeaderValueDescription
Sonolus-SignaturestringSee Sonolus-Signature.

Request Body

type ServerAuthenticateRequest = {
    type: 'authenticateServer'
    address: string
    time: number
    userProfile: ServiceUserProfile
}

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 ServerAuthenticateResponse = {
    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
}