Check whether the user has a valid credentials Jira rest API

I am using jira-client npm module to make API calls on my jira instance, I want to check that if the user has a valid credentials before doing anything else, depending on that I would either:

  • Tell the user that they don’t have a valid username or token.

  • or Let the user use the project functionalities

is that possible? I am able to make calls and with invalid credentials I will got response with a special message, but I want to know if there is a specific call for checking username and token.