Authenticate the patient with the Nabla SDK
Once a Patient is authenticated in your app, you need to authenticate them on Nabla SDK so that they can securely access their conversations.
You already passed a
provideAuthTokens function during the init process. This function will be called when the Nabla SDK needs to authenticate the Patient. It should return an
accessToken and a
refreshToken from your backend. See server side documentation for more details.
You need to call
setCurrentUserOrThrow on the
NablaClient, which you need to call with a stable patient id, as long as the patient didn't change (it will be passed as parameter to the
If you want to change patient, you need to call
clearCurrentUser, as it will clear all data related to the previous patient. Then you will be able to call
setCurrentUserOrThrow with the new patient id.
setCurrentUserOrThrow will throw a
Note that the
provideAuthTokenswill be called only when the SDK needs to identify the patient, it won't be instantaneously called after calling
Make sure you call
setCurrentUserOrThrowat least once before calling any other method of the SDK, otherwise an
UserIdNotSetError will be returned.
Updated 16 days ago