Authorization doesnt work from DHIS2 App

I cloned the latest dhis2-core from github. I ran the debug mode of dhis-web-portal and I can access it from the browser at localhost:8080. I also successfully pass authorization at localhost:8080.

But when I want to do authentication for DHIS2 APP it gives me an error. Im following the tutorial here Getting started with DHIS2 | DHIS2 Developer Portal , with only exception that I have my local version of DHIS2 running.

The error is as follow:

  • WARN 2021-10-22T14:12:53,849 Could not find action or result: /dhis-web-commons-security/login.action (Dispatcher.java [qtp213762292-234])
    IDJf8l0i6HGueU8DwQjnWW6UODUtVeAWxbhx03eQE4S90= com.opensymphony.xwork2.config.ConfigurationException: There is no Action mapped for action name login.
    at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:195) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.apache.struts2.factory.StrutsActionProxy.prepare(StrutsActionProxy.java:57) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.apache.struts2.factory.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:32) ~[struts2-core-2.5.26.jar:2.5.26]
    at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:60) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.apache.struts2.dispatcher.ExecuteOperations.executeAction(ExecuteOperations.java:79) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:141) ~[struts2-core-2.5.26.jar:2.5.26]
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.38.v20210224.jar:9.4.38.v20210224]
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.38.v20210224.jar:9.4.38.v20210224]
    at org.hisp.dhis.servlet.filter.AppOverrideFilter.doFilterInternal(AppOverrideFilter.java:175) ~[dhis-web-commons-2.38-SNAPSHOT.jar:?]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.6.jar:5.3.6]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.3.6.jar:5.3.6]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.3.6.jar:5.3.6]
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.38.v20210224.jar:9.4.38.v20210224]
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.38.v20210224.jar:9.4.38.v20210224]
    at org.hisp.dhis.we

Hi @Daler :tada: welcome to the community!

Sorry you’re facing this issue! I followed the guide step-by-step and the default app was authorized and the local instance of DHIS2 is 2.35.0, so may I ask what is the version of the DHIS2 instance that you are using? Would you try different versions (latest versions) do you see the same issue? The other point I want to get to is does this happen even with the most basic app or is it with this app specifically?

Thanks!

Dear @Gassim,

Thank you for your follow-up. I have the latest DHIS2 instance and that would be 2.38. I generated the simple DHIS2 APP using that tutorial link.

I think the authorization link changed in the latest version. DHIS2 APP, which I generated using d2 cli tries to connect with the link /dhis-web-commons-security/login.action
BUT when I open the local build of DHIS2 the login link is different and looks like dhis-web-commons/security/login.action

Is there anyone from dev team or anyone else faced this issue, so that we can confirm this?

Hey,
You’re welcome!

Would you try using the latest stable release and see if you are still facing this issue?

And you could still take screenshots and describe the issue in a Jira bug issue with the version number of the instance that you are currently using.

Thanks!

@Daler Can you try in 2.37 (now stable)? I would like to see if you get the same error as in 2.38.
I’m seeing this issue too on core-dev (Docker image) which is currently 2.38. I just created an empty app on port 3000 and when I try to authenticate (against my localhost on port 8080) I get:

`Could not find action or result: /dhis-web-commons-security/login.action (Dispatcher.java [http-nio-8080-exec-7])`
` com.opensymphony.xwork2.config.ConfigurationException: There is no Action mapped for action name login.`

I will keep investigating @Daler and keep you posted.

Best!

I fixed it and in my case the issue was not having localhost:3000 in the CORS allow list in the System Settings of the DHIS2 instance. Austin explains it here:

Could this be your issue here?

2 Likes

@german Thanks a lot for your support. I had this CORS thing added but it was not working. I dont know what changed but today I tried it and its working now, though I have not touch it since then.

2 Likes