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.