Authentication

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.

The authenticate(userId:provideAuthTokens:) method requires a provideAuthTokens promise.

It will be called every time the Nabla SDK needs to authenticate the user, and you are responsible for providing an accessToken and a refreshToken from your backend.

See the server side documentation for more details.

NablaClient.getInstance().authenticate(userId, async () => {
  // fetch refresh and access tokens
  return new AuthTokens(refreshToken, accessToken);
});

⚠️

Make sure you call authenticate before calling any other method of the SDK, otherwise an AuthenticationError will be returned.