Version: 1.3.6
This client uses the OAuth2/OIDC Client Credential Flow to obtain an access token. See the main ADH Authentication samples page README for more information about this flow.
- .NET 6.0 or later
- Note: Visual Studio 2022 (v17.1) or later is required for development against .NET 6.0
The sample is configured using the file appsettings.placeholder.json. Before editing, rename this file to appsettings.json
. This repository's .gitignore
rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised.
Replace the placeholders in the appsettings.json
file with your Tenant Id, Client Id and Client Secret, and the current Api Version. There is no need to replace the Namespace Id for this sample.
Developed against DotNet 6.0.
- Register a Client Credential client in ADH.
- Replace the placeholders in the
appsettings.json
file with your Tenant Id, Client Id, and Client Secret obtained from registration. - Note: As a test, a request is made against the users endpoint. If the tenant being used has strict mode enabled and the client does not have Tenant Admin permissions, the test will fail. In this case, it is recommended to change the url to a type or a stream that the client has permission to access.
- Load the .csproj
- Rebuild project
- Run it
- If you want to see the token and other outputs from the program, put a breakpoint at the end of the main method and run in debug mode
- Make sure you have the install location of dotnet added to your path
- Run the following command from the location of this project:
dotnet run
- Load the .csproj from the ClientCredentialFlowTest directory above this in Visual Studio
- Rebuild project
- Open Test Explorer and make sure there is one test called Test1 showing
- Run the test
- Make sure you have the install location of dotnet added to your path
- Run the following command from the location of the ClientCredentialFlowTest project:
dotnet test
Tested against DotNet 6.0
For the main ADH Authentication samples page ReadMe
For the main ADH samples page ReadMe
For the main AVEVA samples page ReadMe