02-19-2024 08:30 AM
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
02-20-2024 06:13 AM
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,
02-21-2024 10:20 PM
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.
02-22-2024 06:35 AM - last edited on 02-22-2024 07:35 AM by Shahzad_Ismail
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,