Graph .NET > Tutorial > Authentication using username / password

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 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.

C# example
VB example

Need help? Ask our developers: