Valid API Key throws error 401 Unauthorized
search cancel

Valid API Key throws error 401 Unauthorized

book

Article ID: 381171

calendar_today

Updated On: 11-03-2024

Products

Clarity PPM SaaS

Issue/Introduction

We have valid key which doesn't expired but while trying to use the same it fails with below error

401 Unauthorized

The request is unauthenticated.

Pass the correct auth credentials

Environment

Component: Clarity

Version: 16.x

 

Cause

In investigation while reviewing app-ca.log we found below error 

ERROR 2024-09-19 16:22:35,060 [https-jsse-nio2-443-exec-166] security.AccessTokenAuthenticationService (clarity:username@domain:none) (97996728-be36-4d02-92d4-532d8340cfbe) Request came with a valid token but could not create a session for user 

ERROR 2024-09-19 16:22:35,060 [https-jsse-nio2-443-exec-166] ppm.rest (clarity:unkown:none) (97996728-be36-4d02-92d4-532d8340cfbe) AuthenticationFilter :: Exception while authenticating user. com.niku.union.security.SecurityException: Authentication Failure Error!

 

The above error occurs when there is either of below mentioned change in the user who created token and hence the API key cannot be validated

  • Users created a Token, but user at present is inactive
  • User created a Token, but user at present is locked
  • Username of user changed post API key creation

Resolution

In case if user is inactive/locked please active or unlock the user. In case of username change please create a new API key.