Ping SDKs

Step 4. Test the app

In the following procedure, you run the sample app that you configured in the previous step. The sample connects to your server and walks through the authentication journey you created in an earlier step.

After successful authentication, the sample obtains an OAuth 2.0 access token and displays the related user information.

  1. In a terminal window, navigate to the sdk-sample-apps/javascript/embedded-login-davinci folder.

  2. Use npm to run the sample:

    npm run dev
  3. In a web browser:

    1. Ensure you are NOT currently logged into the PingOne instance.

      If you are logged into the PingOne instance in the browser, the sample will not work.

      Logout of the PingAM instance before you run the sample.

    2. Navigate to the following URL:

      http://localhost:5173

      A form appears with "Username" and "Password" fields:

      The login page of the JavaScript DaVinci client sample.
      Figure 1. The login page of the JavaScript DaVinci client sample.
  4. Optionally, to register a new identity in PingOne, tap the No Account? Register now! link.

    This link is an example of a FlowButton.

    The app displays the registration screen:

    The DaVinci sample app registration screen
    Figure 2. The DaVinci sample app registration screen.
    1. Enter the details of the new identity, and then click Save.

      The app creates the new identity in PingOne and returns to the sign on screen.

  5. Enter the username and password of a PingOne identity, and then click Sign On.

    The app sends the credentials to PingOne for validation, and on success displays the user’s session info:

    The DaVinci sample app displaying session info
    Figure 3. The DaVinci sample app displaying session info
  6. To get an access token for the user, click Get Tokens.

    The DaVinci sample app displaying tokens
    Figure 4. The DaVinci sample app displaying tokens
  7. To revoke the OAuth 2.0 token, click the Logout button.

    The application calls the /as/revoke endpoint to revoke the OAuth 2.0 token, and returns to the sign-in form.