5.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 the user is logging-in using their login-id of username@bayunsystems.com.
sessionId : Unique sessionId.
You can provide a unique sessionId to the
loginWithoutPasswordfunction call. If an empty sessionId i.e " " is provided, Bayun creates and returns a unique sessionId in the successful authentication response insuccessCallback.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 viaregisterEmployeeWithoutPassword. 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.securityQuestionsCallback : Most developers can just leave it null for default functionality. It is used for taking answers of Security Questions from the User. By default, the SDK uses AlertView to take User’s input for the answers of the Security Questions. The developer can optionally provide a custom UI block for taking User’s input, to match with the look-and-feel of the app, instead of relying on the default alert-view. If non-null, this block will need to take user answers to the security questions as an input and call validateSecurityQuestions API method in the SDK. The Security Questions and QuestionIds are returned through data of the callback, in the form of an ArrayList of HashMap with key "securityQuestions".
passphraseCallback : Optional block if passphrase is enabled. Most developers can just leave it null for default functionality. It is used for taking user passphrase input when passphrase is explicitly enabled by the user. By default, the SDK uses AlertView to take user input for passphrase if it is enabled for a user. However the developer can optionally provide a custom UI block to match with the look-and-feel of the app instead of relying on the default alert-view. If non-null, this block will need to take user passphrase as input and call Bayun validatePassphrase method for Passphrase validation.
successCallback : Success block to be executed after successful user login.
failureCallback : Failure block to be executed if user authentication fails, returns
BayunError.
Validate Security Questions
Use validateSecurityQuestions function to validate the security questions' answers.
The function takes the following parameters :
sessionId : Unique SessionId which is received in the login/registration function response.
answers : Security questions' answers of type
List.successCallback : Success block to be executed after successful Security Questions' Answers validation.
failureCallback : Failure block to be executed if user authentication fails, returns
BayunError.
Validate Passphrase
Use validatePassphrase function to validate the passphrase.
The function takes the following parameters :
sessionId : Unique SessionId which is received in the login/registration function response.
passphrase : Passphrase to validate.
successCallback : Success block to be executed after successful user passphrase validation.
failureCallback : Failure block to be executed if user authentication fails, returns
BayunError.
Sample Code
Last updated
Was this helpful?