astubenbord / paperless-mobile

An (almost) fully fledged mobile paperless client.
GNU General Public License v3.0
675 stars 33 forks source link

[Bug]: login does not work #337

Open manuelkamp opened 8 months ago

manuelkamp commented 8 months ago

What happened?

First of all, after each keypress on virtual keyboard, it hides it and i have to click again into textfield for username or password. Second, login fails (data is correct). From the logs I see, that the app wrongly manipulases my entered username. I just entered 'manuel' and it made something with an @ and some hidden stuff appended.

Steps to reproduce

Open app, try to login

Log output from the app

[      AuthenticationCubit] - _addUser                 : Adding new user manuel@doat..
2023-12-25 11:44:03.179 DEBUG   --- [      AuthenticationCubit] - _addUser                 : Fetching bearer token from the server...
2023-12-25 11:44:03.596 DEBUG   --- [      AuthenticationCubit] - _addUser                 : Bearer token successfully retrieved.
2023-12-25 11:44:03.597 DEBUG   --- [      AuthenticationCubit] - _getApiVersion           : Trying to fetch API version...
2023-12-25 11:44:03.694 DEBUG   --- [      AuthenticationCubit] - _getApiVersion           : Successfully retrieved API version (3).
2023-12-25 11:44:03.694 DEBUG   --- [      AuthenticationCubit] - _addUser                 : Trying to fetch remote paperless user for manuel@do***at.

Screenshots

No response

Paperless-ng*x Version

2.1.2

Paperless-Mobile Version

3.1.8

Device

Xiaomi 13

Operating System Version

14

Device Locale

German

Selected Locale

None

Additional Context

No response

astubenbord commented 8 months ago

Hi, your username is not manipulated; The app creates a user id for each user consisting of username@host, this is also what is printed in your logs (the identifiers are redacted so users can post their logs here without compromising any information). I'll check in the following days.

txthomas commented 8 months ago

@manuelkamp I just faced similar issue with a new user account. PaperlessUnauthorizedException popped up. The account was missing the "View" permissions for "Users". Maybe this can help you too.

manuelkamp commented 8 months ago

I was trying loggin in with my admin account, so I guess it is not missing any rights?

A quick question to the author: Does this app uses any server in between? I have geoblocking on and if it goes for login to another server in the US for example, it will fail.

astubenbord commented 8 months ago

@manuelkamp no, there is nothing in between.

dekimsey commented 8 months ago

I just ran into this myself. I didn't expect a basic user would need read access to the Users since that's listed as an Admin task and the front-end didn't seem to need it. Admittedly, I'm not in a multi-user environment quite yet.

However, may I recommend better fall-back behavior on this issue instead? When the server 403's the API request to /api/users/<id>, the app doesn't handle that very gracefully. The app just sits in a spinner view and must be closed and the authentication credentials re-entered. The credentials were fine, it's logged in without issue. It just cannot read the user because users:view isn't granted.

Thank you!

pSub commented 7 months ago

I stumbled upon this as well. The culprit for me was indeed the missing users:view right. But I also feel kind of bad, because the app informs you pretty clearly about this before you login.

However, I think the app should handle missing rights more gracefully anyways.

dekimsey commented 7 months ago

But I also feel kind of bad, because the app informs you pretty clearly about this before you login.

Huh. TIL I don't read!