The following example shows you how to use OAuth2 authentication with client secret. In order to use OAuth2 authentication you need client id, tenant and client secret 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 registered).
Below we show you two different ways how to set parameters to authenticate. In both cases it will get OAuthToken and you can check property client.OAuthToken after successful authentication.