Auth Endpoint
Path: {operator-env-url}/authenticate
The Auth endpoint is for authenticating users before they are cleared for placing bets. As per the 'Session Endpoint' section, a temporary (short expiry) token should be made available to the frontend. The frontend will pass this temporary token and the userId to BetLink's auth pathway, which ultimately calls this Auth endpoint. This token is named 'launchToken' in the request parameters section below.
This Auth endpoint must return a backend authentication token that will be used subsequently by BetLink for bet placement requests.
Behind the scenes, the operator may implement the functionality as they see fit but there are some strong recommendations:
The operator should validate that there is indeed a valid user session for the relevant user. The user session is valid for auth if there exists a non-expired temporary token and no auth token has been generated yet for this user session.
A random auth token should be generated and stored along with the pre-existing user session. This token is the operatorSessionToken in the response parameters section below.
An expiry date for the above auth token should be set and stored along with the pre-existing user session (recommended 30 minutes).
Request Parameters
type: POST
content-type: application/json
Idempotency
Request will contain a header X-Idempotency-Key
in the form of a UUID string. See 'Idempotency' section for more information.
requestId
String/UUID
Yes
92e02ae9-a2a3-48e2-af0e-940aec4bbcfb
userId
String
Yes
user123
operatorId
String
Yes
operator-id
launchToken
String
Yes
6rI4bf7ghCfk43uyeYJ4Pg
authRequestedTimestamp
String (epoch)
Yes
1640995200000
Success Response Parameters
accepts: application/json
requestId
String/UUID
Yes
Matches request's requestId
userId
String
Yes
user123
operatorId
String
Yes
Matches requests OperatorId
operatorSessionToken
String
Yes
Original or refreshed
timestamp
String (epoch)
Yes
1640995200000
status
String (enum)
Yes
AUTHENTICATED
sessionExpiry
String (epoch)
Yes
1640995200000
redirectUrl
String
Yes
https://imgarena.com (Please return your homepage url)
Error Response Parameters
accepts: application/json
status
String ("FAILED_AUTHENTICATION")
Yes
FAILED_AUTHENTICATION
Always this value
errorCode
String (enum)
Yes
INVALID_SESSION
Must be an Error Code from the Errors table below
errorMessage
String
Yes
User has not passed validation checks
Can be any debug information operator wishes to respond with
Errors
INVALID_USER
400
USER_BLOCKED
400
MISSING_PARAMETER
400
INVALID_SESSION
401
AUTHENTICATION_FAILED
403
GENERAL_EXCEPTION
500
REQUEST_TIMED_OUT
503
Last updated