When 2FA is enabled, every login / sign-in require users to input password and TOTP along with their user ID. Also, when strict security measures like device tracking is enabled, users are required to enter the OTP sent to their email ID to authorise the device.
With such security measures, a regular user account cannot be used to invoke the OpenSpecimen APIs by automated systems. External systems use APIs to pull/push the data from/to the OpenSpecimen.
...
Table of Contents | ||
---|---|---|
|
Introduction
Starting v8.1, a new type of user - API user is implemented.
API users are a special type of users a) that user who do not require OTP for sign-in and b) whose devices are not tracked. However, they have one important restriction - the security restriction: API calls can be restricted to a certain IP address (or range) of the device from which the APIs can be invoked is fixed. It cannot be any random IP.
It will be the responsibility of the super administrator to configure the API user and share the details with concerned parties after doing due diligence.
Steps:
Navigate to Home → Users → Create
Select Yes as the answer for API User?
Specify the host IP address or range of allowed IP addresses in the text box appearing below the API User? as illustrated in the image below -
...
IP address can be:
Host IP address as in 142.250.67.196. This means the API user account can be used to invoke APIs from this IP address alone.
IP address range using Network address / mask notation (aka CIDR notation). For example: 142.250.0.0/16. This allows to invoke API from any IP falling the range - 142.250.0.0 - 142.250.255.255 (for a total of 65,025 IP addresses)
Few more examples:
142.250.67.0/24 signifies the range 142.250.67.0 - 142.250.67.255 (for a total of 255 IP addresses)
142.250.67.248/29 specifies the range 142.250.67.248 - 142.250.67.255 (for a total of 8 IP addresses)
Frequently Asked Questions
How to reset the password of an API user?
Ans: You can either reset it manually via the UI or include the reset password process in your API code.
API Details:
URL | https://<URL>/rest/ng/users/password | ||
Method | PUT | ||
Request Payload |
| ||
Response | true |
Is there any way to stop expiring API user password?
Ans: No. You have to manually reset the API user password or update the code to reset the password programmatically using #1.
Can we configure multiple subnets in the IP address field?
Ans: Yes, you can configure multiple subnet IP ranges. Each IP range has to be separated using a comma.
For e.g, 192.168.0.0/16,204.48.25.207,104.131.254.19