cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Urgent: Issue with OTP Verification - Error Code 40001

pavanipalvai
New Contributor

We are currently experiencing an issue with OTP verification in our application. We got the following response.

Error Details:
- Error Code: 40001
- Message: "The JSON value could not be converted to System.String. Path: $.sms.code | LineNumber: 0 | BytePositionInLine: 34."
- Reference IDs Affected:
1. d974cb24-66ed-4eb8-9d6c-44cb827ac9da
2. 705b9d53-5f48-4e53-be1c-dfa83fddbc98
3. c26aa131-d9c4-4625-b137-1ee353767a4a

This error is hindering the OTP verification process, and we are unable to proceed with user authentication. We kindly request your prompt attention to investigate and resolve this issue.

Please let us know if there is any additional information or logs required from our end to assist in the resolution process

3 REPLIES 3

Alex_Sberna
Employee
Employee

Hello pavanipalvai,

Thank you for reaching out and I'm sorry to hear you're experiencing issues. Can you provide what method you are using to make the Verification request, i.e. using one of the native application SDKs or the REST API, as well as a sample of the code?

Thank you,

Alex Sberna, Documentation Engineer

I am using the REST API method for the Verification request. Below is a sample of the code I am using:

let data = JSON.stringify({ "method": "sms", "sms": { "code": otpCode } });
let configuration = {
method: 'put', maxBodyLength: Infinity,
url: `${sinchApiUrl}/id/${referenceId}`,
headers: { 'Content-Type': 'application/json', 'Authorization': `Basic ${authToken}` }, data: data };
let result;
await axios.request(configuration) .then((response) => {
       result = response.data;
}).catch(();

Note: We are not facing this error for every request.

It looks like the issue is that the sms.code is being sent as a number and not as a string in the instances where you are receiving the errors. You should be able to fix this by ensuring that the sms.code value is always sent as a string.
If this doesn't fix your issue or if you have any further issues with this, please contact the Sinch Support team (follow the guidelines in the Sinch Customer Support Process) and they can provide more detailed assistance.

Thanks,

Alex Sberna, Documentation Engineer