Skip to main content

Authentication

Note: This method is part of the Common API, exposed by the Common WebService.

The LoginSession endpoint authenticates the user and creates a session on the WebService, returning an authentication token (AuthToken) for use in subsequent calls to the Common API.


HTTP POST Request

Request TypeExample URL
POST{{url_base}}/LoginSession
Examplehttp://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"LoginSession"

Input Parameters

ParameterTypeRequiredDescription
LoginString(100)YesUser name for system authentication
EncryptedPasswordStringYesUser's encrypted password. When Active Directory authentication is enabled, it must be sent in AES‑256/CBC using the same key as the mobile app
BranchNoString(25)YesBranch code where the user is signing in

Return

ParameterTypeRequiredDescription
WebServiceReturnWebServiceReturnYesStandard WebService response information when executing the method.
SessionInfoDataLoginSessionInfoDataYesObject with authenticated session data, including the authentication token (AuthToken)

📝 LoginSessionInfoData object

The LoginSessionInfoData object represents the session information created after login.

Return Parameters

ParameterTypeRequiredDescription
UserCodeIntegerYesInternal user code in the system
UserNameStringYesShort user name
AuthTokenStringYesAuthentication token generated for the session. Must be used in the AuthToken field of authenticated calls.
AuthTokenExpirationDateTimeYesDate/time when the authentication token expires (after this time, a new login is required)

Request Example

curl --location 'http://seuIPePorta/datasnap/rest/RESTWebServiceMethods/"LoginSession"' \
--header 'Content-Type: application/json' \
--data '{
"Login": "edata",
"EncryptedPassword": "7012A6A2FE642116DE7BB",
"BranchNo": "0102",
"AuthType": "atMIMS"
}'

Response Example

{
"WebServiceReturn": {
"Status": "wrsSuccess",
"ErrorCode": "",
"Message": "",
"Actor": "",
"ReturnQuestion": null
},
"SessionInfoData": {
"UserCode": 12345,
"UserName": "TEST USER",
"AuthToken": "3F2C8A0D4B61441FAF9D0C2A6B8E9F10",
"AuthTokenExpiration": "2025-11-11T21:00:00"
}
}