The following example shows you how to use OAuth2 authentication with username and password. In order to use
OAuth2 authentication you need client id and tenant from your app registration (you have to add and register
your application using the App registrations experience in the Azure portal if is not already
Below we show you two different ways how to set parameters to authenticate. In both cases it will get OAuthToken and you can check client.getOAuthToken() after successful authentication.