MSG91/sendotp-android

OTP verification initialization is failing

Closed this issue · 4 comments

OTP verification initialization is failing on API 28, following is the stack trace

I/ApiService: generateRequest: http://control.msg91.com/api/sendotp.php?authkey="my auth key"&mobile=91XXXXXXXXXX&message=Hello%20Shantanoo%2C%20your%20verification%20code%20for%20JIVITVA%20app%20is%20%23%23OTP%23%23.&sender=JIVITV&otp_expiry=5&otp_length=4&invisible=0&userip= W/System.err: java.io.IOException: Cleartext HTTP traffic to control.msg91.com not permitted at com.android.okhttp.HttpHandler$CleartextURLFilter.checkURLPermitted(HttpHandler.java:115) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:458) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538) at c.h.a.a.g.b.c(:67) at c.h.a.a.g.b.a(:41) W/System.err: at c.h.a.a.g.b.b(:164) at c.h.a.a.g.b.a(:202) at c.h.a.a.g.j$a.a(:94) W/System.err: at c.h.a.a.g.j$a.doInBackground(:86) at android.os.AsyncTask$2.call(AsyncTask.java:333) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:764) E/e: Verification initialization failed: Request Unsuccessful Try Again

Also please check the same on other APIs after which clearTextTraffic is disabled by default. Please see below Android 8: Cleartext HTTP traffic not permitted

Hi, EffyCoder
We are working on the issue, very soon we will update you :)

@iamrajendra @IrshadWalker @rakshitsoni02 Have you fixed this issue yet? I was able to get OTP on Pie device by allowing clearTextTraffic from control.msg91.com by adding following code in network_security_config.xml file
</network-security-config> <domain-config cleartextTrafficPermitted="true"> <domain includeSubdomains="true">control.msg91.com</domain> </domain-config> </network-security-config> in xml folder under res directory.

And in AndroidManifest.xml file under application tag,

android:networkSecurityConfig="@xml/network_security_config". Please check it and let me know. Lot of our customers have Pie version. I am checking if it's working on all other devices. Have you made any other fixes which are necessary then please let me know. I am using
com.msg91.sendotpandroid.library:library:0.7
version.

This is also a correct approach you can also see official doc of android here: https://developer.android.com/training/articles/security-config

For a better experience kindly use new version 1.3.1