Security, Privacy, AI and CSR information for all Piano products now lives in one place. Explore our Compliance Center.
Subscriptions
English French
English French

What is the isUserValid() parameter used for?

If you need to check if a user is logged in or not, you can use the Piano function isUserValid() in your JavaScript. But is tp.user.isUserValid() any different than tp.pianoId.isUserValid()?

The parameter tp.user checks if a userRef is present, so it shouldn’t be used for Identity Management integrations.

The tp.user.isUserValid function uses the parameter isUserValid from the user provider which is configured for the application.

    var _isUserValid = function () {
      return _getProvider().isUserValid();
    };
    var _getProvider = function () {
...
       if (pianoId.isConfigured()) {
        return pianoId;
      }
...
 else {
        return userRefProvider;
      }
    };

So tp.user.isUserValid() should work correctly for any user provider.

More information about the userRef integration is available here.

Last updated: