← Back to team overview

dhis2-devs team mailing list archive

Re: API not showing 401 Unauthorized error

 

Hi Morten,

The password is set wrong deliberately so as to get a 401 or other
response. The problem is when you set the wrong password or username you
get endless redirects from the API.

Regards,


On Fri, Apr 20, 2018 at 1:24 PM, Morten Olav Hansen <morten@xxxxxxxxx>
wrote:

> It should be district, not distric... but also people keep changing our
> internal passwords (our database resets every 24 hour)
>
> --
> Morten Olav Hansen
> Senior Engineer, DHIS 2
> University of Oslo
> http://www.dhis2.org
>
> On Fri, Apr 20, 2018 at 12:09 PM, Rangarirai Matavire <matavirer@xxxxxxxxx
> > wrote:
>
>> By the way, its not just the error response code that is worrying, but
>> also the loop of redirects that starts, this makes it difficult to handle
>> the response for an http client. To see this loop of redirects, you can add
>> -L to curl as below.
>>
>> curl -I -L -u admin:distric -H 'Accept: application/json'
>> https://play.dhis2.org/2.28/api/me
>>
>> I think this behaviour should be corrected as it may lead to unexpected
>> behaviour of apps.
>>
>> Regards
>>
>> On Wed, Apr 18, 2018 at 11:10 PM, Rangarirai Matavire <
>> matavirer@xxxxxxxxx> wrote:
>>
>>> Hi Devs,
>>>
>>> I am wondering whether the behaviour I am seeing is a bug or something
>>> to be expected due to some change.
>>>
>>> When I run the following curl command:
>>>
>>> curl -I -u admin:distric -H 'Accept: application/json'
>>> https://play.dhis2.org/2.29/api/me
>>>
>>> I get an HTTP 302 response. Note that I have deliberately set the
>>> password wrong so I can mock a 401 unauthorized response. I get the same
>>> response when I run the command on version 2.28. However, as expected, when
>>> I run it on 2.27, 2.26 etc I get a 401 HTTP response.
>>>
>>> I hope someone can assist.
>>>
>>> Regards,
>>>
>>> Ranga
>>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>

Follow ups

References