The SDK provides two options, Promise and Event listener, to handle responses. You can choose either approach based on your preference.
Handle response in Promise
signIn function returns a Promise if user credentials (username, password) are provided. Success and error responses can be easily handled in the standard Promise way.
Handle response in Event listener
You can also register event listeners from the
EventEmitter function in the SDK to handle responses.
Note: Make sure that listeners are properly unregistered by using
Handle transaction state
As transaction states are evaluated during primary authentication, this SDK also exposes a
getAuthClient function to return an instance of
@okta/okta-auth-js client to handle Authentication API communication. See Node JS and React Native Usage(opens new window) for more information.
One general use case is that you can resume a transaction from the
authClient to continue handling transactions for statuses other than