On-discover 403 error

Hii @IntegrationSupport @Hardik

client id - SBX_002358

After getting response from https://dev.abdm.gov.in/gateway/v0.5/care-contexts/discover api from the app we have called this api https://dev.abdm.gov.in/gateway/v0.5/care-contexts/on-discover

This is the request body we are sending to https://dev.abdm.gov.in/gateway/v0.5/care-contexts/on-discover

we are getting 403 error status code

we are stuck with this please kindly provide the solution as early as possible

@pritamsingh07100 This is wrong request body you are sending to on-discover

Body should look like something

{
"requestId": "{{$guid}}",
"timestamp": "{{$isoTimestamp}}",
"transactionId": "fd98a895-0df0-4491-8743-b5f544779762",
"patient": {
     "referenceNumber": "ref_007",
        "display": "dummy_sample",
        "careContexts": [
            {
                "referenceNumber": "dummy_saref_cc_007mple_1",
                "display": "OPD Records April07"
            }
        ],
    "matchedBy": [
        "MOBILE"
    ]
},
"resp": {
    "requestId": "6c05987a-c5c1-4708-b720-ec83abb67257"
}

}

requestId and transactionId these two values you will get from response of discover API called by ABDM

hii @kiran02

by mistake i have uploaded the wrong snapshot of the code
i have changed the snapshot now please help me with solution

@pritamsingh07100 You need also send correct transactionId that you got from ABDM gateway
then return response in this format

{
      status: response.status,
      statusText: response.statusText,
      data: response.config.data,
}

@kiran02 i have updated the request body snippet still getting 403

@pritamsingh07100 Make sure that authorization token valid and not expired & valid one.
More importantly, on-disover API should be called within 5 seconds as there is time factor as soon as get discover call from gateway. I suspect, you are late on calling the on-discover . Please check if this is the case.

@kiran02
I will describe the process that I am following. Please tell me if I am wrong in any steps.
I am calling the /v0.5/care-contexts/discover through the PHR App (Please also let us know if any permission/roles is required). After receiving the response, on-discover is called with the transactionId and requestId received from discover(/v0.5/care-contexts/discover) API.
PFA snap of the request body which we used.

@pritamsingh07100 Yes you are correct here. But are you calling the on-discover quickly enough within 5 seconds? It is required as there is time factor element for this API.

@kiran02 Yes as soon as we receives the response from discover api we are calling the on-discover api within 2 seconds

@pritamsingh07100 I’m not sure then what could be issue. It is working fine for me though.
@IntegrationSupport Please kindly check in to this.

@kiran02 please let me know is any role or permission required in our client id for using discover apis

@pritamsingh07100 I’m not sure. but it did work for me without any extra permission/roles.

@kiran02 hy its working now the problem is with my authorization token we are getting 202 in response but what about the body were we will get the body because in webhook itself we are getting 202

Good. it worked for you

@kiran02 Yes it worked but we are getting 202 but unable to received the response

@pritamsingh07100 202 Accepted. That means your request has accepted by ABDM gateway. You will not see response there, that’s expected behaviour.
But soon after on-discover API call with returning proper response. You should get resposne from ABDM gateway with url v0.5/links/link/init to which you have respond again with /v0.5/links/link/on-init

@kiran02 @IntegrationSupport we are getting 202 accepted but we are not receiving any callback response from ABDM gateway with URL v0.5/links/link/init can you please check the logs what is happing because we tried so many time we are getting only 202 accepted but not receiving the response in our webhook

@pritamsingh07100 You will receive call on callback once user hits “Link Selected” button in PHR mobile app.

@kiran02 In the PHR app, when we click the “Fetch Records” button, the app sends a request to the Discover API. Once the app receives a response from the Discover API, we immediately calling the “on-discover” API. However, even after doing this, the app is unable to find the user’s details and displays a “could not find the user details” message.

@pritamsingh07100 You supposed to be return response in this format on calling on-discover

  {
      status: response.status,
      statusText: response.statusText,
      data: response.config.data,
}