401 Error in in GenerateOtp

Getting this error when trying to generate Aadhaar OTP:

        "timestamp": "2022-07-27T07:46:20.974+0000",
        "status": 401,
        "error": "Unauthorized",
        "message": "Unauthorized",
        "path": "/api/v1/registration/aadhaar/generateOtp"

Client ID: SBX_001122

We are getting a proper response from the gateway when requesting for our refreshtoken.

Request headers:

    'Content-Type': 'application/json', 
    'Accept': 'application/json', 
    'Accept-Language': 'en-us', 
    'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICIyMWU5NzA4OS00ZTcxLTQyNGEtOTAzYS1jOTAyMWM1NmFlNWYifQ.eyJleHAiOjE2NTg5MDg1NDMsImlhdCI6MTY1ODkwNjc0MywianRpIjoiZjc0MjZjNmItODNhOS00ZjFkLTliN2MtNjY3ZTk2NmRiYThjIiwiaXNzIjoiaHR0cHM6Ly9kZXYubmRobS5nb3YuaW4vYXV0aC9yZWFsbXMvY2VudHJhbC1yZWdpc3RyeSIsImF1ZCI6Imh0dHBzOi8vZGV2Lm5kaG0uZ292LmluL2F1dGgvcmVhbG1zL2NlbnRyYWwtcmVnaXN0cnkiLCJzdWIiOiI2MGZiOWQyMC0yOTdhLTRmMzgtOTYyMy1jZjdhY2U4NjRlZGEiLCJ0eXAiOiJSZWZyZXNoIiwiYXpwIjoiU0JYXzAwMTEyMiIsInNlc3Npb25fc3RhdGUiOiJhMTc5MzJmMi04OTNjLTRjZTEtYmIzZS1hMjhkOTA5MjYyY2QiLCJzY29wZSI6Im9wZW5pZCBlbWFpbCBwcm9maWxlIn0.A_sExUeMvTxNlgu2z7q6jhvBGPFWUBPD7GJeHxZxQcY'

Request Body:

    'aadhaar': '36XX82XX30XX'
1 Like

@Ramandeep1 - can you please request @suraj to look into this please

@suraj Please help us resolve this, Its been 2 weeks now

@Ramandeep1 - can you please request @suraj - please look into this if required roles are assigned.

@prithoo-mslate - can you ensure the auth token has not expired and check if you are using the correct API for token generation (API - /v1/registration/mobile/generateOtp).

Also, can you check if HID role is assigned to your client id using getServices API. (https://sandbox.abdm.gov.in/swagger/ndhm-devservice.yaml)

@SARCH1 Hi, thank you for replying.

The auth token is generated at the time of sending the request to the sandbox to generate the aadhaar OTP so it should still be active when the request is made.

I shall check the role at the given endpoint and get back to you.

Hi @prithoo-mslate kindly check again, the HID role has been assigned to you now.



I am afraid it is still giving me the same error, @Ramandeep1

I have checked this issue, there is no health id role for this token, below is the token decrypted

“exp”: 1658908543,
“iat”: 1658906743,
“jti”: “f7426c6b-83a9-4f1d-9b7c-667e966dba8c”,
“iss”: "https://dev.ndhm.gov.in/auth/realms/central-registry",
“aud”: "https://dev.ndhm.gov.in/auth/realms/central-registry",
“sub”: “60fb9d20-297a-4f38-9623-cf7ace864eda”,
“typ”: “Refresh”,
“azp”: “SBX_001122”,
“session_state”: “a17932f2-893c-4ce1-bb3e-a28d909262cd”,
“scope”: “openid email profile”