4.4 Login without Password

The loginWithoutPassword function is the instance function that initialises your access to Bayun. The function takes the following parameters :

Let's say an employee has loginId username@bayunsystems.com.

  • sessionId : Unique sessionId.

    You can provide a unique sessionId to the authenticate function call. If an empty sessionId i.e " " is provided, Bayun creates and returns a unique sessionId in the successful login response in ShAuthenticateResponse.

    Same sessionId should be provided in all the subsequent calls to the Bayun APIs as an argument.

  • companyName : Unique name of the company/tenant the authenticating employee belongs to, e.g. "bayunsystems.com". This should be chosen using exactly the same methodology that was used during user registration via registerEmployeeWithoutPassword. Note that in some cases the email domain of the user could be different from the domain of the tenant this user belongs to. In such a case, the domain-name part of the tenant is what should be used as the companyName parameter.

  • companyEmployeeId : EmployeeId unique within the company, e.g. "username@bayunsystems.com". This should also be chosen using exactly the same methodology that was used during user registration via registerEmployeeWithoutPassword. Note that while just the "username" portion might suffice in some cases, it is preferable to use the full loginId for consistency.

The loginWithoutPassword function returns shared pointer to the classAuthenticateResponse i.e ShAuthenticateResponse.

Following are the possible values of BayunAuthResponseCode in ShAuthenticateResponse:

  • Success : Authentication is successful.

  • VerifySecurityQuestions : If only security questions are enabled, Security Questions and QuestionIds are returned in the form of std::vector<SecurityQuestionInfo*>in ShAuthenticateResponse. Login completes when answers are validated for the security questions.

  • verifyPassphrase : If passphrase is enabled, login completes when passphrase is validated.

  • EmployeeAuthorizationPending : When BayunCore is inited with App Secret having only role Creation , EmployeeAuthorizationPendingis returned as BayunAuthResponseCode if the employee authorization is pending on the app server side. Employee Public Key data is returned as employeePublicKey. Check Authorize Employee for employee authorization.

Use validateSecurityQuestions function to validate the security questions' answers.

The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the loginWithoutPassword function response.

  • answers : Security questions' answers of type std::vector<SecurityQuestionAnswer*>.

Use validatePassphrase function to validate the passphrase.

The function takes the following parameters :

  • sessionId : Unique SessionId which is received in the loginWithoutPassword function response.

  • passphrase : Passphrase to validate.

Sample Code

Last updated

Was this helpful?