matomo-org / matomo-mobile-2

Matomo Mobile 2 App - The official Git repository! Liberating Web Analytics on the go!
https://matomo.org/mobile
Other
103 stars 31 forks source link

Matomo Mobile 2 HTTP error “bad request” #5426

Open mreeve opened 3 years ago

mreeve commented 3 years ago

We are using Matomo 4.2.1 and trying to login via the Matomo Mobile 2 (2.4.10) iOS app. However, when we try to login we are getting the following error:

Network Error There was an error “HTTP error”. The request returned the status “bad request”. URL was “https://sitedomain.com/analytics/index.php”. Please check your entered URL and the error logs on this server for more information about the error and how to resolve it.

I’ve check the error logs at both the server level and matomo’s debugger and have not found anything useful.

I’ve tried different users including users with easier passwords to make sure it wasn’t a url encoding issue. I’ve tried super users, write users, and read users. We have multiple sites so I tried creating a user that has permissions to just one site. Nothing has helped.

The site is behind load balancer, but I've tried hitting the server directly. Both had the same failing result.

I’ve looked through the source code of both the mobile app and matomo and from what I can see they seem to be fine, but the app still fails. From what I could see from the mobile app, I put together what I think the url that is being requested:

https://sitedomain.com/analytics/index.php?userLogin=username&md5Password=passwordhere&passwordConfirmation=passwordhere&module=API&format=json&method=UsersManager.createAppSpecificTokenAuth&description=Matomo Mobile 2

This link works fine and returns a json object with the value. But for some reason, if this is the same url used within the iOS app, it fails.

Any help would be appreciated. Thank you.

sgiehl commented 3 years ago

Hi @mreeve. I actually don't have an apple device, but did you try to open the url you mentioned on your iOS device where the mobile app doesn't work? Wondering if that might be any kind of ad blocker that maybe blocks the request?

mreeve commented 3 years ago

@sgiehl Good thought. I just tried your suggestion and got successful results from Safari and Chrome using two different Matomo accounts. It seems to only be an issue from inside the mobile app.

sgiehl commented 3 years ago

Are you maybe using some self signed certificate? Did you maybe try to connect the mobile app to the Matomo demo?

mreeve commented 3 years ago

@sgiehl I noticed the mobile app was using POST instead of GET to send the info. I switched to using a POST and received the same 400 Bad Request error. I'm now in talks with our network/server admins to see if they have something blocking POST requests.

I'll reply with further details if we get this resolved.

tsteur commented 3 years ago

Thanks @mreeve I'll mark this issue for now as closed as it looks like a web server configuration issue where POST requests are causing issues. Be great to indeed reply further details if you get this resolved and should there still be any issue we will be happy to reopen any time. Hoping your network/server admins can help with this @mreeve . BTW the reason we're using POST requests is for security to prevent certain tokens appearing in web server logs etc.