With this approach, the callbacks for onSuccess and onError can be handled in the initialization process of the SDK. This is a valid approach if you are using the default SDK UI component.
You may have designed your own login UI and need to hook up the login / sign in button event. This will not be possible with the callbacks approach so we have provided a promise approach.
With the above code you initialize the sdk and then use the sdk to login when you press the button and use await to wait for the authentication login response.