account_exists ()
Function prototype | account_exists (account, secret, [country_code = null], [team = null], [shared_key = null]) |
---|---|
API Version | 2.7.19 and higher |
SOAP, REST |
Description
Checks if the 'account_ref' provided is a valid login identifier (can be used to perform a session_init())
This function can be used prior to a call to session_init () to know wheter the account exists or not. If the account does not exist, it may be necessary to create a new account first (sign up).
When the account doesn’t exist, the function also indicates if it is allowed to create a new account.
This is useful in a 2-step login, where in a first step only the account name is entered, and the following step depends on the existence of the account:
If the account name exists, then the password is requested and session_init () can be invoked
If the account name doesn’t exist it is possible to offer the opportunity of creating a new account (if it is allowed to create a new account)
For security reasons, only authorised users who know the "secret" can call this function. The secret string is delivered by Linkcare only to authorised partners
Input parameters: |
|
Output parameters: |
|
Request example
instance_account_exists ("loginid", “kjsad9q734yhafsjk”);
instance_account_exists ("loginid", “kjsad9q734yhafsjk”, "es");
Response
The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API
Return Error codes
ERROR CODE |
|
---|---|
INSUFFICIENT_PRIVILEGES | The parameter secret is not valid. Only authorized clients can check the existence of a user |
Conditions to decide the existence of an account
The account exists when:
The account indicated corresponds to a CASE or a PROFESSIONAL that has already initiated session before.
The account corresponds to a CASE or PROFESSIONAL that has never signed-in before (a PROFESSIONAL created by and administrator, or a CASE created by some PROFESSIONAL), but a default password has been assigned to the account. This means that the user should be able to sign-in using the default password
The account doesn’t exist when:
The account is not found (there is no contact in the platform with the provided account value)
The account exists internally but corresponds to a CASE or a PROFESSIONAL that has never initiated session before, and no default password has been assigned. This means that there is no way for the user to do a sign-in and it is necessary to follow the sign-up process to assign a new password. In this situation, the account_exists() function will indicate that the account doesn’t exist.
Conditions to allow the sign-up of a new account
Additionally, when the account corresponds to a user that has never done a sign-in, the account_exists() function will also indicate whether sign-up is permitted or not.
To allow sign-up, the holder of the account should have never signed-in before and additionally one of the following conditions must be met:
The account provided corresponds to a CASE (patient) that has been created in the platform by a PROFESSIONAL (the account exists internally), and without a default password (when a default password is assigned to the account, the system assumes that it will be notified to the CASE so that he can do a normal login).
The shared_key contains an explicit invitation to sign-up
The team provided has a default Program assigned with the “auto-enroll” property enabled.
The platform is configured with a default SUBSCRIPTION, and the TEAM OWNER of the SUBSCRIPTION has the “auto-enroll” property enabled (see the $GLOBALS['CASE_DEFAULT_SUBSCRIPTION'] configuration parameter in WEB SERVICES CONFIGURATION )
After the first successful sign-in of a user, the account_exists() function will never say again that the sign-up is allowed.