Web api authorization not working

Forwarding to the dev list.

···

On Feb 7, 2018 8:31 PM, “Terence Kaite” terencekaite@icloud.com wrote:

Hello there,

I’ve been trying to build an external web app that should be making use of dhis 2 data through the its’ web api endpoints. But when I try to access dhis web apis - even after including credentials for authentication (username:password bases64encoded) as value for the authorization request header, I’m getting a “response for preflight is invalid (redirect)”. (I’m using basic authentication). And when I monitor the network activity in chrome dev tool I came to discover that the preflight OPTION request method is also being redirected, which shouldn’t be the case.

I really need to get my app connect to dhis, I’m building it as part of the country’s Health Information System. I will greatly appreciate any assistance in how I can solve this issue, or any workable solution I can refer to. Thanks a lot.

Regards

Terence

Sent from my iPhone

Did you whitelist your domain in CORS settings?

···

On Thu, Feb 8, 2018 at 2:37 AM, Knut Staring knutst@gmail.com wrote:

Forwarding to the dev list.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Feb 7, 2018 8:31 PM, “Terence Kaite” terencekaite@icloud.com wrote:

Hello there,

I’ve been trying to build an external web app that should be making use of dhis 2 data through the its’ web api endpoints. But when I try to access dhis web apis - even after including credentials for authentication (username:password bases64encoded) as value for the authorization request header, I’m getting a “response for preflight is invalid (redirect)”. (I’m using basic authentication). And when I monitor the network activity in chrome dev tool I came to discover that the preflight OPTION request method is also being redirected, which shouldn’t be the case.

I really need to get my app connect to dhis, I’m building it as part of the country’s Health Information System. I will greatly appreciate any assistance in how I can solve this issue, or any workable solution I can refer to. Thanks a lot.

Regards

Terence

Sent from my iPhone

Hi Terence,

have a look at the CORS concept: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

You can whitelist the URL/domain of your app from Apps > Settings > Access > CORS whitelist.

regards,

Lars

···

On 8 February 2018 at 09:15, Morten Olav Hansen morten@dhis2.org wrote:

Did you whitelist your domain in CORS settings?


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Thu, Feb 8, 2018 at 2:37 AM, Knut Staring knutst@gmail.com wrote:

Forwarding to the dev list.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

On Feb 7, 2018 8:31 PM, “Terence Kaite” terencekaite@icloud.com wrote:

Hello there,

I’ve been trying to build an external web app that should be making use of dhis 2 data through the its’ web api endpoints. But when I try to access dhis web apis - even after including credentials for authentication (username:password bases64encoded) as value for the authorization request header, I’m getting a “response for preflight is invalid (redirect)”. (I’m using basic authentication). And when I monitor the network activity in chrome dev tool I came to discover that the preflight OPTION request method is also being redirected, which shouldn’t be the case.

I really need to get my app connect to dhis, I’m building it as part of the country’s Health Information System. I will greatly appreciate any assistance in how I can solve this issue, or any workable solution I can refer to. Thanks a lot.

Regards

Terence

Sent from my iPhone

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org