Consent pin Forgot Pin - Token verification failed

Hi,

We are getting error when resetting the consent pin. (API -/patients/reset-pin)

Getting token verification failed error

x-auth-token is the temporaryToken


Tried sending it with "Bearer " prefix & without it. It is not working.

temporaryToken is working for other consent APIs.

@shubham_1745,

Please check the below logs and use the below APIs because its working fine for my ABHA Id(Patient_Id).

–> POST https://dev.ndhm.gov.in/cm/patients/verify-pin
Content-Length: 93
Content-Type: application/json
X-AUTH-TOKEN: Bearer eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJnYW5hcGF0aHlwODVAc2J4IiwiY2xpZW50SWQiOiJURVNUX1BIUiIsInN5c3RlbSI6IkFCSEEtQSIsInJlcXVlc3RlcklkIjoiUEhSLVdFQiIsInBock1vYmlsZSI6bnVsbCwiZXhwIjoxNjcxNjIzNzUxLCJpYXQiOjE2NzE2MTY1NTEsInBockFkZHJlc3MiOiJnYW5hcGF0aHlwODVAc2J4IiwidHhuSWQiOiI5MTEyN2I1YS1mYzIyLTRkMmMtYmNiYi1iNmM5MDE0YzJiZmYifQ.mVBuprXg7j9ujxCoZ-aqAEUoRUfOZGGEXhbhHgkXsRA0CSXioFNITnsptcNyzMFmplAuMjBKrXRs9KemqQhRNxJbSJRxYPbddYjwTTAcOWNEAyHflcX-WP9juw6-SKO6R7wwfIafc4HlMyJNSCplGE1_eCInZX5waMwYmCQ0pzrPLjO4kPAe0q-fZaPECiiJbeqgzX7xo1Z01VPM0VVF4C3q5jwWEutNZbSPi1J8z_9RG7LRyjJecIEDSDSzgqNi5lUN1W2Zsxg86Wu6uQrKMm0svQd6jWUZjn_6ibi2UgZl5S7viTOLPU6N2-el1BYfbnuvT_CeAW5YM9vGrzuGRg
{“pin”:“3009”,“requestId”:“eed5c2c8-8c4b-4aa6-9402-d4de8e726e19”,“scope”:“profile.changepin”}
–> END POST (93-byte body)
<-- 200 OK https://dev.ndhm.gov.in/cm/patients/verify-pin (655ms)

correlation-id: 9b2b549d-88b6-480a-a17a-fd2c2ea52d22
content-type: application/json
content-length: 563
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-content-type-options: nosniff
strict-transport-security: max-age=31536000 ; includeSubDomains
x-frame-options: DENY
x-xss-protection: 1 ; mode=block
referrer-policy: no-referrer
x-envoy-upstream-service-time: 223
date: Wed, 21 Dec 2022 09:57:34 GMT
Set-Cookie: TS01960242=01445fed04ea33c2bb21cd53c50239f11cbf19fcb0f412ab72ced6702b0f55441035747a7083793429841ebc4fe3ce7c032c4d74b0; Path=/
{“temporaryToken”:“eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJnYW5hcGF0aHlwODVAc2J4IiwiZXhwIjoxNjcxNjE2Nzc0LCJpYXQiOjE2NzE2MTY2NTQsInNpZCI6ImUwMDY4MzE4LWVmMjctNDIyNC1hMmYxLTEyODQ5ZGI0OThkMCIsInNjb3BlIjoicHJvZmlsZS5jaGFuZ2VwaW4ifQ.izeoQrx4o39s-SH-ELTSmt_hG7CNYvohHa8QJ-b5YWfyyI4fq-DvVX5raDF-8-yEZ6y5BwgzEcTCwhnWIAn9K36zrwYu1z3HpCPa3jhlPdYcQgoYWPvQx3O3xA-vk77lYxheWkit5W-p6M5-aIA665yPBaKUeyWYQ-sdOfyrWT3zEoElpnVKXE326zhF0mqKGprHY-mSKoHgUyl4V66uRRP7MuiMU-EUZsnQ7f4Gwfw4ROmXZ6ygkNhsQZ7sry_xcMiMtLDpyOIf9OdVNJAkAbtenjfxwAgnKl-KvsSfe0vCxbI6GxOj5O_S2RpGSfkEDL0rauKpNtkvrQdaylCfIg”}
<-- END HTTP (563-byte body)

–> POST https://dev.ndhm.gov.in/cm/patients/change-pin
Content-Length: 14
X-AUTH-TOKEN: eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJnYW5hcGF0aHlwODVAc2J4IiwiZXhwIjoxNjcxNjE2Nzc0LCJpYXQiOjE2NzE2MTY2NTQsInNpZCI6ImUwMDY4MzE4LWVmMjctNDIyNC1hMmYxLTEyODQ5ZGI0OThkMCIsInNjb3BlIjoicHJvZmlsZS5jaGFuZ2VwaW4ifQ.izeoQrx4o39s-SH-ELTSmt_hG7CNYvohHa8QJ-b5YWfyyI4fq-DvVX5raDF-8-yEZ6y5BwgzEcTCwhnWIAn9K36zrwYu1z3HpCPa3jhlPdYcQgoYWPvQx3O3xA-vk77lYxheWkit5W-p6M5-aIA665yPBaKUeyWYQ-sdOfyrWT3zEoElpnVKXE326zhF0mqKGprHY-mSKoHgUyl4V66uRRP7MuiMU-EUZsnQ7f4Gwfw4ROmXZ6ygkNhsQZ7sry_xcMiMtLDpyOIf9OdVNJAkAbtenjfxwAgnKl-KvsSfe0vCxbI6GxOj5O_S2RpGSfkEDL0rauKpNtkvrQdaylCfIg
Content-Type: application/json
{“pin”:“4678”}
–> END POST (14-byte body)
<-- 200 OK https://dev.ndhm.gov.in/cm/patients/change-pin (687ms)
correlation-id: 113508df-9150-41e9-8368-6b3565fa2d4b
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-content-type-options: nosniff
strict-transport-security: max-age=31536000 ; includeSubDomains
x-frame-options: DENY
x-xss-protection: 1 ; mode=block
referrer-policy: no-referrer
content-length: 0
x-envoy-upstream-service-time: 147
date: Wed, 21 Dec 2022 09:58:08 GMT
Set-Cookie: TS01960242=01445fed04905ed81d7140ee234c375859bd80c2b8b3ac0ce0c283264207fd70fa4c0eece28b66b512213b2a25e687485a226383d7; Path=/
<-- END HTTP (0-byte body)
Activity_launch_request id:in.ndhm.phr.debug time:41324051
–> POST https://dev.ndhm.gov.in/cm/patients/verify-pin
Content-Length: 98
Content-Type: application/json
X-AUTH-TOKEN: Bearer eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJnYW5hcGF0aHlwODVAc2J4IiwiY2xpZW50SWQiOiJURVNUX1BIUiIsInN5c3RlbSI6IkFCSEEtQSIsInJlcXVlc3RlcklkIjoiUEhSLVdFQiIsInBock1vYmlsZSI6bnVsbCwiZXhwIjoxNjcxNjIzNzUxLCJpYXQiOjE2NzE2MTY1NTEsInBockFkZHJlc3MiOiJnYW5hcGF0aHlwODVAc2J4IiwidHhuSWQiOiI5MTEyN2I1YS1mYzIyLTRkMmMtYmNiYi1iNmM5MDE0YzJiZmYifQ.mVBuprXg7j9ujxCoZ-aqAEUoRUfOZGGEXhbhHgkXsRA0CSXioFNITnsptcNyzMFmplAuMjBKrXRs9KemqQhRNxJbSJRxYPbddYjwTTAcOWNEAyHflcX-WP9juw6-SKO6R7wwfIafc4HlMyJNSCplGE1_eCInZX5waMwYmCQ0pzrPLjO4kPAe0q-fZaPECiiJbeqgzX7xo1Z01VPM0VVF4C3q5jwWEutNZbSPi1J8z_9RG7LRyjJecIEDSDSzgqNi5lUN1W2Zsxg86Wu6uQrKMm0svQd6jWUZjn_6ibi2UgZl5S7viTOLPU6N2-el1BYfbnuvT_CeAW5YM9vGrzuGRg
{“pin”:“4678”,“requestId”:“12db4ec1-14d5-4cbd-833c-ef7003aab76e”,“scope”:“consentrequest.approve”}
–> END POST (98-byte body)

<-- 200 OK https://dev.ndhm.gov.in/cm/patients/verify-pin (351ms)
correlation-id: ce5b32e1-3702-4bf0-87b8-1763c0ba5e11
content-type: application/json
content-length: 569
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
expires: 0
x-content-type-options: nosniff
strict-transport-security: max-age=31536000 ; includeSubDomains
x-frame-options: DENY
x-xss-protection: 1 ; mode=block
referrer-policy: no-referrer
x-envoy-upstream-service-time: 209
date: Wed, 21 Dec 2022 09:58:09 GMT
Set-Cookie: TS01960242=01445fed047d5bf5039157ff8170fd2bcea7a08e930479bab50af8ae6c3fabe8040245842ccb1e25677806b878bdcda6abfb637d44; Path=/
{“temporaryToken”:“eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJnYW5hcGF0aHlwODVAc2J4IiwiZXhwIjoxNjcxNjE2ODA5LCJpYXQiOjE2NzE2MTY2ODksInNpZCI6IjkxYWIyNjkyLWQwYTUtNGFlNi1hZDQ4LTc1ZGVmZGMxMTI3MyIsInNjb3BlIjoiY29uc2VudHJlcXVlc3QuYXBwcm92ZSJ9.VcrkvxjtrqldZZkRhL_KlYSxkPJXOhLa4gKqNm9fiiLSatUtcLwLQxVD2oqthm2yXaiv74hhJGuovgnbJvRBn01iE_SvDDr3VLJSh_WEeMzJ35anC2SQxdqDPGsc4t-kngPh0RbDwPZol5jsEh64sYdo26yrsEyxiVCQunV9_IrihdHEyABCniSfPn332nGDd08jwmTqR-RAI9di85tTwCKanTUQd9thHrgVC2PiIOrPuUl28jW_bpDdPSAjoIc6S6SDTQavWi5XSSuDzGtTquIiZ7ftfLAjrZuvL9TMQBGaZxt7jcwcyygK4jFy5X-2teSZO0gHuZSN1KnrIceUyQ”}
<-- END HTTP (569-byte body)

Thanks.

@Govind_Deshmukh the issue we are facing is in forgot pin API. The change pin APIs we have successfully implemented.

APIs we are facing issue for:

/patients/forgot-pin/generate-otp - Working fine
/patients/forgot-pin/validate-otp - Working fine
/patients/reset-pin - Not working

API Doc - https://sandbox.abdm.gov.in/swagger/ndhm-phr-app.yaml

Hi @shubham_1745,
Please use this curl curl --location --request POST ‘https://dev.abdm.gov.incm/patients/reset-pin
–header ‘X-AUTH-TOKEN;’
–header ‘Content-Type: application/json’
–data-raw ’ {“pin”:“9433”}’
and use x-auth token in header
Thanks

Hi @Deepak-LTI ,

https://dev.abdm.gov.in/cm/patients/forgot-pin/generate-otp

Not able to test the mentioned flow because above API is down

This resolved now. Thanks.

Hi @shubham_1745
I am also facing the same issue… Could you kindly mention how it got resolved. Thanks in advance

@anandhini X-Auth-Token in /reset-pin API is the temporary token that you will get after validating the OTP using /patients/forgot-pin/validate-otp API.

X-Auth-Token for this API is is not the token you get after logging in.

Hi @shubham_1745. I was using temporary token only… I haven’t added Bearer prefix… Should we add Bearer prefix?

@anandhini Bearer prefix is not needed. Can you share the error you are getting & request cURL?

@shubham_1745 please find the error screenshot below:

request cURL :
curl --location ‘https://dev.abdm.gov.in/cm/patients/reset-pin’ \

–header ‘X-Auth-Token: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJGT1JHT1RfQ09OU0VOVF9QSU4xMDU1ZDZjMy03YmVlLTQwZmMtOTZhOC03YjI1NzY1NWZhODciLCJleHAiOjE2ODMxNTU0NDcsImlhdCI6MTY4MzEzNzQ0N30.a4nSEe8O_Uu2Bp5e0AUB2tywcDgq99WDtJMy6fRAkPvVVt7m7M5sI3umfxQP2fbeCZGT_4xJzvA7P4UxFAOPqQ’ \

–header ‘Content-Type: application/json’ \

–header ‘Cookie: TS011c04bd=01445fed04a48384dc60b8680b0cde482655fbe648e5fb12e159530bded24c61f97f9177ee4bba9efef824e3e3b1a53b3cd82b37d9’ \

–data ’ {“pin”:“2222”}’

@anandhini Your request method is POST. Try with PUT.

@shubham_1745. thanks a lot… after changing to PUT , its working fine…

@shubham_1745 Hi I am facing an issue with the change-pin API I am using the temp temporary token which was received in verify-pin but still having this error can you please suggest what is missing here?

i have attached the screen shot for reference.

@awez.a Change your method to PUT. it should work.

@shubham_1745 I have tried with the put but still have the same error also tried with the Bearer and without Bearer keyword on the token. but having same issue

@shubham_1745 I have found the issue, I am sending the wrong scope in verify-pin so I have changed it to profile.changepin, and now it’s working. Thanks