Support Document
0 mins to read
Service Account Guidelines — Making API requests to MyGeotab
Support Document
0 mins to read
Service accounts are functionally similar to real user accounts in the MyGeotab database. Service accounts are used exclusively by your solution to make API requests against the MyGeotab database outside of user sessions. Service accounts must be used by integrated solutions, and not by people.
Making API requests to MyGeotab
Last updated August 2024
Service accounts are functionally similar to real user accounts in the MyGeotab database. A service account has a username, password, first name, last name, security clearance, etc. Service accounts are added to the database in the same way as a real user, from the MyGeotab application or with an API request.
Service accounts are used exclusively by your solution to make API requests against the MyGeotab database outside of user sessions. Service accounts must be used by integrated solutions, and not by people.
! IMPORTANT: We strongly recommend the following:
If your solution needs to access the data in a customer's MyGeotab database or make changes to the database when there is no active user interacting with the solution, it will require a service account.
Common scenarios that require service accounts:
There is no cost associated with creating an additional user in a MyGeotab database. However, some customer services may result in data costs to the service account end-user. Contact your Partner for details.
It is mandatory for the username of a service account to:
✱ NOTE: Usernames do not need to be valid email addresses, but they can be.
Examples of proper service account usernames:
If the database name is "myDatabase", the service account name can be:
It is mandatory for service account’s passwords to follow the requirements below to ensure they are secured:
! IMPORTANT: Each service account in different customer databases must have different passwords.
Security clearances determine what the account can do within the MyGeotab database.
If a service account is only pulling data from a database, the View only security clearance is recommended.
If the service account must make changes to the database, you must decide which Security clearance it needs by following this process:
Custom security identifiers for MyGeotab Add-Ins are available and can be defined in the configuration.json file of Add-Ins. This adds them to the list of permissions available when editing clearances. These definitions can support multiple languages.
The Administrator clearance will remain non-editable and have all custom clearances enabled by default. All other default or system clearance levels only allow editing of custom security identifiers, while keeping the system defined default identifiers non-editable.
✱ NOTE: By default, once the enableViewSecurityId property in the configuration.json for an Add-In is set to True, a View “Add-in name” add-in identifier is created. It must be enabled for users to view the Add-In. You need to set more granular control within the Add-In code for any custom identifiers added to the configuration.json.
To add a service account to a database via the MyGeotab UI:
You must decide who is responsible for adding the service account to the database. The three common workflows are:
The next sections detail each workflow.
This method includes more manual work from both parties to set up the service account and address any issues with it in the future. However, it is convenient to set up.
For Solutions that use an Add-In, this is the recommended approach to add the service account. It reduces the ongoing workload for your company and the Customer as well, and it makes the Add-In setup process easier.
To log into the application, the service account must perform the Authenticate API call, with a POST HTTP request where applicable. The Authenticate call receives the service account username, password, and the Customer’s database name as input.
If the Authenticate API call is successful, it returns a Login Result, which contains a Credentials object. The Credentials object will contain the username, database, and session ID of the service account’s newly-created session. The session ID can be used in place of the “password” in all future API calls.
Almost every API call besides Authenticate requires a Credentials object as input. If your service account has a session ID, the Credentials objects of future API calls will look like this:
{
“database”: <database name>
“username”: <service account username>
“sessionId”: <session id received from the result of Authenticate call>
}
Notice that the password is no longer being used when making API calls. Instead, you will use the session ID.
The session ID expires after 14 days, or if the MyGeotab server shuts down for any reason.
Using an expired or invalid session ID in an API call will result in the “Incorrect Login Credentials” error. When you see this, you should perform another Authenticate API call, to receive a new session ID.
✱ NOTE: A Service account should log into the application once every 14 days, because a sessionId lasts for up to 14 days. See the “Service Accounts login via SDK” for details on how to reuse the session ID.