USER credentials

shabbir9
Tera Contributor

HI 

 

I am sharing APIS and basic user accounts from ServiceNow to other tool ..but the problem is my i am sharing the basic authentication user name and password ..it is expiring in two days(and says untheorized user) and again i am creating another user for testing and sharing with them can anyone help on this why user account says untheorized in two days,... how to resolve it

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @shabbir9 ,
I trust you are doing great.

you can leverage token-based authentication using OAuth 2.0.

OAuth 2.0 allows you to generate access tokens that can be used to authenticate API requests. These tokens can have a longer expiration time and can be easily renewed without the need to create new user accounts each time.

Here's a high-level solution to implement OAuth 2.0 authentication in ServiceNow:

  1. Set up an OAuth 2.0 provider: Configure ServiceNow to act as an OAuth 2.0 provider. This involves creating an OAuth 2.0 client and defining the allowed scopes and permissions.

  2. Obtain access tokens: Instead of using basic authentication, your other tool should obtain an access token from ServiceNow by making a request to the OAuth 2.0 token endpoint. This request will include the client credentials, such as client ID and client secret, along with the appropriate grant type.

  3. Access token usage: Once the other tool receives the access token, it should include it in the Authorization header of each API request to ServiceNow. The access token serves as proof of authentication, and ServiceNow can validate its authenticity and permissions.

  4. Token expiration and renewal: To address the two-day expiration issue, you can configure the access token's expiration time to a longer duration in ServiceNow's OAuth 2.0 configuration. Additionally, you can implement a token renewal mechanism in the other tool, where it automatically requests a new access token before the current one expires. This way, you won't need to create new user accounts frequently.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



customer wants basic auth only...kindly tell me how to do with basic what changes i need to do for not to expire basic auth