# Authentication for non https schems

**URL:** <https://forum.getodk.org/t/authentication-for-non-https-schems/32967>\
**Category:** Development\
**Tags:** odk-collect\
**Created:** [March 25, 2021, 1:10pm UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967 "2021-03-25T13:10:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor\_Kakama](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/victor_kakama/32/14987_2.png) [@Victor\_Kakama](https://forum.getodk.org/u/Victor_Kakama)\
**Post date:** [March 25, 2021, 1:10pm UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967/1 "2021-03-25T13:10:17Z")

</div>

Hi Community,  
I recently was trying to link latest Collect app to an openrosa server thats running on http and was getting a 401 response.  
On investigating i realised in OkHttpOpenRosaServerClientProvider line 98

```
if (scheme.equalsIgnoreCase("https")) {
daBuilder.with("basic", new BasicAuthenticator(cred));
}
```
  
why would the client send auth info to only https servers?

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [March 25, 2021, 4:28pm UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967/2 "2021-03-25T16:28:14Z")

</div>

Basic auth is only secure if you send the auth through the encrypted channel that HTTPS provides. See [https://en.wikipedia.org/wiki/Basic\_access\_authentication#Security](https://en.wikipedia.org/wiki/Basic_access_authentication#Security) for more.

---

<div class="post-metadata">

**Author:** ![Victor\_Kakama](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/victor_kakama/32/14987_2.png) [@Victor\_Kakama](https://forum.getodk.org/u/Victor_Kakama)\
**Post date:** [March 26, 2021, 8:05am UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967/3 "2021-03-26T08:05:35Z")

</div>

Thank you @yanokwa, the reality is that there are many who will want to test the app on non https channels, shouldn't we let the app send auth info and its upon the server host to ensure sacurity, other than dropping that info.

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [March 26, 2021, 11:54am UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967/4 "2021-03-26T11:54:15Z")

</div>

> [@Victor\_Kakama](#):
>
> shouldn't we let the app send auth info and its upon the server host to ensure sacurity

If you don't have a secure channel, the auth is sent in cleartext and is subject to a [man-in-the-middle attack](https://en.wikipedia.org/wiki/Man-in-the-middle_attack).

ODK is often used for projects where privacy and security matter. We default to doing things securely unless there is a really good reason. Testing on non-HTTPs channels is not a good reason.

If this is a blocker for you, you can make these changes on your fork. I don't recommend it, but it's your choice.

---

<div class="post-metadata">

**Author:** ![Victor\_Kakama](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/victor_kakama/32/14987_2.png) [@Victor\_Kakama](https://forum.getodk.org/u/Victor_Kakama)\
**Post date:** [March 28, 2021, 5:27pm UTC](https://forum.getodk.org/t/authentication-for-non-https-schems/32967/5 "2021-03-28T17:27:52Z")

</div>

I get You. Thank you.
