Authentication
User login
For company admins, super admins or system owners, the API will return a session value, and a email contains an OTP code will be sent to the user. We will use this code and the session value for 2FA after.
For other users, the API will return the IdToken, which can be used to authenticate with the server.
const response = await geocore.Auth.login({
username: "exampleUser",
password: "examplePassword"
});
Parameters
name type data type description username required string Username password required string Password
Responses
http code content-type response 200 application/json For super admins: { "data": { "session": "AYABeFW7uXaPG..." } }For other users: { "data": { "token": { "AccessToken": "eyJraWQiOiJ0XC9...", "ExpiresIn": 86400, "IdToken": "eyJraWQiOiI4Z2...", "RefreshToken": "eyJjdHkiOiJKV1QiL...", "TokenType": "Bearer" }, "user": { "_id": "6767815eec700eacba53ce59", "sub": "d7648ab8-0041-706b-5e7a-2441e5b437c1", "name": "Name", "username": "username", "email": "sample@gmail.com", "oneSignalIds": [], "dateCreated": "2024-12-22T03:02:54.101Z", "access": { "level": "user", "platforms": [], "dataLimit": 0 }, "groups": [ "676786fea9f601ea8e9a5cd1" ], "dateModified": "2024-12-22T03:02:54.101Z", "__v": 0, "lastLoginTime": "2025-01-12T10:11:00.841Z" } } }400 application/json { "code": 400, "message": "Error message" }500 application/json { "code": 500, "message": "Uncaught internal server error" }
Verify user MFA
2FA verification for super admins after calling login API.
const response = await geocore.Auth.verifyCode({
username: "exampleUser",
session: "sessionId",
code: "123456",
});
Parameters
name type data type description username required string Username session required string Session value received after calling login API with super admin user code required string 2FA verification code sent to user's email
Responses
http code content-type response 200 application/json { "data": { "token": { "AccessToken": "eyJraWQiOiJ0XC9...", "ExpiresIn": 86400, "IdToken": "eyJraWQiOiI4Z2...", "RefreshToken": "eyJjdHkiOiJKV1QiL...", "TokenType": "Bearer" }, "user": { "_id": "6767815eec700eacba53ce59", "sub": "d7648ab8-0041-706b-5e7a-2441e5b437c1", "name": "Name", "username": "username", "email": "sample@gmail.com", "oneSignalIds": [], "dateCreated": "2024-12-22T03:02:54.101Z", "access": { "level": "superAdmin", "platforms": [], "dataLimit": 0 }, "groups": [], "dateModified": "2024-12-22T03:02:54.101Z", "__v": 0, "lastLoginTime": "2025-01-12T10:11:00.841Z" } } }400 application/json { "code": 400, "message": "Error message" }500 application/json { "code": 500, "message": "Uncaught internal server error" }
Forgot password
Used when user wants to submit a forgot password request.
const response = await geocore.Auth.forgotPassword({
username: "exampleUser",
});
Parameters
name type data type description username required string Username
Responses
http code content-type response 200 application/json { "data": { "CodeDeliveryDetails": {}, "metadata": {} } }400 application/json { "code": 400, "message": "Error message" }500 application/json { "code": 500, "message": "Uncaught internal server error" }
Confirm password
After send forgot password request, user will receive an email with a verification code, use that code to submit a confirm reset password request.
const response = await geocore.Auth.confirmResetPassword({
username: "exampleUser",
password: "newPassword",
code: "123456",
});
Parameters
name type data type description username required string Username password required string User's new password code required string Verification code sent to user's email
Responses
http code content-type response 200 application/json { "data": { "metadata": {} } }400 application/json { "code": 400, "message": "Error message" }500 application/json { "code": 500, "message": "Uncaught internal server error" }
New user register
Register a new user.
const response = await geocore.Auth.register({
username: "exampleUser",
password: "BVT2FMhbaaXGwPoC3SRoJipqBsiqo127FbbMMf5@69d3!9d1V@?T8*6PDSXw",
email: "user@example.com",
name: "string",
});
Parameters
name type data type description username required string Username password required string Password required string name required string Full name
Responses
http code content-type response 200 application/json { "message": "User registered successfully", "data": { "sub": "b7449a68-7011-7093-a563-a2d3822167dc", "name": "Name", "username": "username", "email": "sample@gmail.com", "oneSignalIds": [], "dateCreated": "2025-01-15T16:28:32.550Z", "access": { "level": "user", "platforms": [], "dataLimit": 0 }, "groups": [], "_id": "6787e23067c4b2fcbcbb8392", "dateModified": "2025-01-15T16:28:32.551Z", "__v": 0 } }400 application/json { "code": 400, "message": "Error message" }500 application/json { "code": 500, "message": "Uncaught internal server error" }
Log out
Log out from current session.
geocore.Auth.logout();