This client uses the OAuth2/OIDC Authorization Code Flow + PKCE to obtain an access token. See the main Cds Authentication samples page README for more information about this flow.
- Node.js 12.6.0+
- Web Browser with Javascript enabled
- You will need Google Chrome if you want to run the automated test
- Register an AuthorizationCode client in Cds and ensure that the registered client in Cds contains
http://localhost:5004/callback.html
, andhttp://localhost:5004/silent-refresh.html
in the list of RedirectUris. - Configure the sample 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 TenantID and ClientID obtained from registration. The username and password fields are used for testing and can be left as is.
You can learn more about the config options here.
-
Make sure Node.js is installed, installation instructions are available at node.js
-
Clone the git repository
-
Install dependencies, using the command line:
npm ci
-
Start the http server to host the sample, using:
npm start
-
Open a browser and navigate to
http://localhost:5004
-
Click on
Login
and follow the prompts to log in to Cds
- Make sure the sample client in the section above is running.
- Make sure Google Chrome is installed on your test system.
- Make sure the version of Chrome matches the version defined for the
chromedriver
dependency in package.json.- If the dependency needs to be updated in
package.json
, after saving, runnpm i
in a command prompt inside this folder to update the package.
- If the dependency needs to be updated in
- Update the
appsettings.json
file with the username and password for the Microsoft account that will be used to log in. The test is only written to work with a personal Microsoft account and must only prompt for only username followed by password (no Two-Factor authentication or other consent or informational prompts). Also if the location of the sample application has been modified then change the url location.
Run the command:
npm test
For the main Cds Authentication samples page ReadMe
For the main Cds samples page ReadMe
For the main AVEVA samples page ReadMe