aunefyren / wrapperr

Website based application that summarizes Plex statistics from a given period and displays it in a nice format. Similar to the Spotify Wrapped concept.
314 stars 22 forks source link

400 bad request when trying to login after creating admin user #72

Closed Jomack16 closed 12 months ago

Jomack16 commented 1 year ago

After creating the admin username and password, trying to login to the admin page gives the following error: 400 Bad Request This is happening for this call: POST http://192.168.1.61:8282/api/get/wrapperr-version

This is my create statement for the Docker container: docker create \ --name=plexwrapper \ --hostname=plexwrapper \ -e TZ=America/Chicago \ -p 8282:8282 \ --restart=unless-stopped \ aunefyren/wrapperr

I have tried creating a volume for the config as well (-v /opt/DockerAppdata/plexwrapper:/app/config). Same issue.

aunefyren commented 1 year ago

Are you able to get the logs, either from the Docker or Wrapperr?

$ docker logs plexwrapper 

or wrapperr.log in app/config/

Jomack16 commented 1 year ago

wrapperr.log

Yes, uploaded the wrapperr.log here.

aunefyren commented 1 year ago

Huh, very odd. I created a container using your Docker command, and I managed to create the admin account and log in. I do get the 400 myself, but it is not stopping me from using the admin panel. The 400 is related to Wrapperr being unconfigured.

Are you unable to log in?

Jomack16 commented 1 year ago

|\ \ |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ \ \ \ \ \ \ \ |\ \ \ |\ \ \ |\ \ \ |\ \ \ /| \ \ |\ \ \ |\ \ \ \ \ \ \ \ \ _\ \ \ \ __\ \ ___\ \ \|/\ \ \ \ \ \ \ |__\ \ \ \ |\ \ \ \ \ \ _| \ \ \| \ \ _|\ \ \ \ |\ \ \ | \ _\ \\ \ \ \\ _\ _\ \ _\ \ \\ _\ \ \ _\ \ |____| |||| |||| || || |___| |||| ||||


|____|____|____|____|____|____|____\ |____||____||____||____||____||____||____|

Log file set. 2023/11/08 04:31:00 Running version v3.2.0. 2023/11/08 04:31:00 Starting Wrapperr on port 8282. 2023/11/08 04:31:00 Starting using HTTP. [GIN] 2023/11/08 - 12:44:34 | 200 | 2.6434ms | 192.168.1.219 | GET "/" [GIN] 2023/11/08 - 12:44:34 | 200 | 8.451228ms | 192.168.1.219 | GET "/js/functions.js" [GIN] 2023/11/08 - 12:44:34 | 200 | 19.24283ms | 192.168.1.219 | GET "/assets/css/wrapped.css" [GIN] 2023/11/08 - 12:44:34 | 200 | 474.235µs | 192.168.1.219 | GET "/js/index.js" [GIN] 2023/11/08 - 12:44:34 | 200 | 188.108µs | 192.168.1.219 | GET "/js/get_functions.js" [GIN] 2023/11/08 - 12:44:34 | 200 | 493.034µs | 192.168.1.219 | GET "/js/get_stats.js" [GIN] 2023/11/08 - 12:44:34 | 200 | 363.581µs | 192.168.1.219 | GET "/assets/img/gift.svg" [GIN] 2023/11/08 - 12:44:34 | 200 | 928.396µs | 192.168.1.219 | GET "/assets/loading.gif" [GIN] 2023/11/08 - 12:44:34 | 200 | 252.263µs | 192.168.1.219 | GET "/assets/external-link.svg" [GIN] 2023/11/08 - 12:44:34 | 200 | 233.971µs | 192.168.1.219 | GET "/assets/done.svg" [GIN] 2023/11/08 - 12:44:34 | 200 | 422.574µs | 192.168.1.219 | GET "/assets/close.svg" [GIN] 2023/11/08 - 12:44:34 | 200 | 325.401µs | 192.168.1.219 | GET "/assets/trash.svg" [GIN] 2023/11/08 - 12:44:34 | 200 | 2.519234ms | 192.168.1.219 | GET "/assets/img/favicons/favicon.ico" [GIN] 2023/11/08 - 12:44:35 | 400 | 2.964904ms | 192.168.1.219 | POST "/api/get/wrapperr-version" [GIN] 2023/11/08 - 12:44:46 | 200 | 204.885µs | 192.168.1.219 | GET "/admin" [GIN] 2023/11/08 - 12:44:46 | 200 | 1.496444ms | 192.168.1.219 | GET "/assets/css/admin.css" [GIN] 2023/11/08 - 12:44:46 | 200 | 404.004µs | 192.168.1.219 | GET "/js/admin.js" [GIN] 2023/11/08 - 12:44:46 | 200 | 680.065µs | 192.168.1.219 | GET "/js/adminFunctions.js" [GIN] 2023/11/08 - 12:44:46 | 400 | 565.11µs | 192.168.1.219 | POST "/api/get/wrapperr-version" 2023/11/08 12:44:46 Retrieved Wrapperr admin state. - Origin: 192.168.1.219 [GIN] 2023/11/08 - 12:44:46 | 200 | 448.001µs | 192.168.1.219 | POST "/api/get/admin-state" 2023/11/08 12:44:49 Created and retrieved admin login JWT Token. - Origin: 192.168.1.219 [GIN] 2023/11/08 - 12:44:49 | 200 | 2.559846ms | 192.168.1.219 | POST "/api/login/admin" [GIN] 2023/11/08 - 12:44:49 | 200 | 39.889µs | 192.168.1.219 | GET "/admin" [GIN] 2023/11/08 - 12:44:49 | 400 | 568.217µs | 192.168.1.219 | POST "/api/get/wrapperr-version" 2023/11/08 12:44:49 Retrieved Wrapperr admin state. - Origin: 192.168.1.219 [GIN] 2023/11/08 - 12:44:49 | 200 | 97.983µs | 192.168.1.219 | POST "/api/get/admin-state"

Jomack16 commented 1 year ago

above is the output from docker logs -f plexwrapper

I am unable to login to the admin panel after creating the admin user. I am using the firefox browser, if that makes a difference.

cyberweasel commented 1 year ago

Having a similar problem. It's been working fine but today tried to open and it said unconfigured. I tried to admin username and pass and then it goes to admin login but entering that info just goes back to the same page. I am seeing 400 errors in the logs too. I see this line....New admin account created. Server is now claimed. but then I can't login. I tried pulling the docker image again. Same result.

aunefyren commented 1 year ago

v3.2.0 had some major front end changes, particularly for JS.

@cyberweasel or @Jomack16, can one of you confirm visiting the site in private mode (which ignores the cached version) doesn't fix this issue?

Jomack16 commented 1 year ago

hi, just tried in a private window. same issue unfortunately. attached .HAR of that attempt. private window HAR.zip

Animosity022 commented 1 year ago

Hmm, same issue here as I created a new docker, tried a private window, different passwords and whatnot and won't let me login either.

AlexanderEpolite commented 1 year ago

Doing this for me as well, on the newest GitHub release zip and by cloning the repo directly.

AlFontal commented 1 year ago

I am having the same issue with wrapperr running on docker on a Raspberry Pi 4B.

Tried accessing the site from an M1 Macbook Pro both in normal and private browsing mode from Firefox, Chrome and Safari.

I was able to create the admin account but whenever I login it just gets stuck on the login panel, with the logs showing:

2023/11/12 09:28:52 Created and retrieved admin login JWT Token. - Origin: 192.168.1.135 

[GIN] 2023/11/12 - 09:28:52 | 200 |    6.080638ms |   192.168.1.135 | POST     "/api/login/admin"

[GIN] 2023/11/12 - 09:28:52 | 200 |      237.83µs |   192.168.1.135 | GET      "/admin"

[GIN] 2023/11/12 - 09:28:52 | 304 |     151.257µs |   192.168.1.135 | GET      "/js/functions.js"

[GIN] 2023/11/12 - 09:28:52 | 304 |     158.128µs |   192.168.1.135 | GET      "/js/adminFunctions.js"

[GIN] 2023/11/12 - 09:28:52 | 304 |     121.202µs |   192.168.1.135 | GET      "/js/admin.js"

[GIN] 2023/11/12 - 09:28:52 | 304 |     930.487µs |   192.168.1.135 | GET      "/assets/css/admin.css"

[GIN] 2023/11/12 - 09:28:52 | 400 |     1.68468ms |   192.168.1.135 | POST     "/api/get/wrapperr-version"
ollebro commented 1 year ago

I have the same issues as AlFontal, same logs as well.

aunefyren commented 1 year ago

I am having issues replicating this issue, but might have figured out the cause. Can someone who is experiencing this try out the newest main branch by compiling it with:

$ go build .

or the beta Docker image: ghcr.io/aunefyren/wrapperr:beta.

Make sure to entire refresh the page/try an incognito window to make sure your browser is not caching any old data.

Animosity022 commented 1 year ago

I pulled the beta tag from the docker, stopped the instance, removed any old data, started a private window and tested that route, but got the same error.

Logs are very minimal.

Log file set.
2023/11/13 06:56:43 Running version v3.2.1.
2023/11/13 06:56:43 Starting Wrapperr on port 8282.
2023/11/13 06:56:43 Starting using HTTP.

[GIN] 2023/11/13 - 06:56:58 | 200 |    1.388286ms |    192.168.1.98 | GET      "/admin"
2023/11/13 06:56:58 Admin config file does not exist. Creating.
2023/11/13 06:56:58 Retrieved Wrapperr version. - Origin: 192.168.1.98
[GIN] 2023/11/13 - 06:56:58 | 200 |    2.587574ms |    192.168.1.98 | POST     "/api/get/wrapperr-version"
2023/11/13 06:56:58 Retrieved Wrapperr admin state. - Origin: 192.168.1.98
[GIN] 2023/11/13 - 06:56:58 | 200 |     197.286µs |    192.168.1.98 | POST     "/api/get/admin-state"
2023/11/13 06:57:08 New admin account created. Server is now claimed.
[GIN] 2023/11/13 - 06:57:08 | 201 |    3.269695ms |    192.168.1.98 | POST     "/api/create/admin"
[GIN] 2023/11/13 - 06:57:08 | 200 |     136.343µs |    192.168.1.98 | GET      "/admin"
2023/11/13 06:57:08 Retrieved Wrapperr version. - Origin: 192.168.1.98
[GIN] 2023/11/13 - 06:57:08 | 200 |     3.53591ms |    192.168.1.98 | POST     "/api/get/wrapperr-version"
2023/11/13 06:57:08 Retrieved Wrapperr admin state. - Origin: 192.168.1.98
[GIN] 2023/11/13 - 06:57:08 | 200 |     248.931µs |    192.168.1.98 | POST     "/api/get/admin-state"
2023/11/13 06:57:13 Admin login failed. Incorrect admin username or password. - Origin: 192.168.1.98
[GIN] 2023/11/13 - 06:57:13 | 401 |    4.001438ms |    192.168.1.98 | POST     "/api/login/admin"
aunefyren commented 1 year ago

2023/11/13 06:57:13 Admin login failed. Incorrect admin username or password. - Origin: 192.168.1.98

Could this be something else? I see you got a 401 response and a complaint about bad credentials. Could you have typed the credentials wrong, or perhaps something is broken regarding the admin creation?

Animosity022 commented 1 year ago

I'd say admin creation and whatever it is setting the password as. I tried 3 times with private browsers and I'm awake enough to not type the wrong password numerous times.

AlexanderEpolite commented 1 year ago

I am having issues replicating this issue, but might have figured out the cause. Can someone who is experiencing this try out the newest main branch by compiling it with:

$ go build .

or the beta Docker image: ghcr.io/aunefyren/wrapperr:beta.

Make sure to entire refresh the page/try an incognito window to make sure your browser is not caching any old data.

2023/11/13 19:08:15 Running version v3.2.1.
2023/11/13 19:08:15 Starting Wrapperr on port 8282.
2023/11/13 19:08:15 Starting using HTTP.
[GIN] 2023/11/13 - 19:08:17 | 200 |    1.007505ms |  127.0.0.1 | GET      "/"
[GIN] 2023/11/13 - 19:08:17 | 200 |     4.07966ms |  127.0.0.1 | GET      "/assets/css/wrapped.css"
[GIN] 2023/11/13 - 19:08:17 | 200 |     618.652µs |  127.0.0.1 | GET      "/js/functions.js"
[GIN] 2023/11/13 - 19:08:17 | 200 |     363.173µs |  127.0.0.1 | GET      "/js/index.js"
[GIN] 2023/11/13 - 19:08:17 | 200 |     455.546µs |  127.0.0.1 | GET      "/js/get_stats.js"
[GIN] 2023/11/13 - 19:08:17 | 200 |     198.646µs |  127.0.0.1 | GET      "/js/get_functions.js"
[GIN] 2023/11/13 - 19:08:18 | 200 |     254.779µs |  127.0.0.1 | GET      "/assets/img/gift.svg"
[GIN] 2023/11/13 - 19:08:18 | 200 |     250.209µs |  127.0.0.1 | GET      "/assets/close.svg"
[GIN] 2023/11/13 - 19:08:18 | 200 |     170.256µs |  127.0.0.1 | GET      "/assets/external-link.svg"
[GIN] 2023/11/13 - 19:08:18 | 200 |     165.736µs |  127.0.0.1 | GET      "/assets/trash.svg"
[GIN] 2023/11/13 - 19:08:18 | 200 |    2.950641ms |  127.0.0.1 | GET      "/assets/loading.gif"
[GIN] 2023/11/13 - 19:08:18 | 200 |     459.576µs |  127.0.0.1 | GET      "/assets/done.svg"
[GIN] 2023/11/13 - 19:08:18 | 200 |     710.254µs |  127.0.0.1 | GET      "/assets/img/favicons/favicon.ico"
2023/11/13 19:08:18 Admin config file does not exist. Creating.
2023/11/13 19:08:18 Retrieved Wrapperr version. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:18 | 200 |     740.585µs |  127.0.0.1 | POST     "/api/get/wrapperr-version"
[GIN] 2023/11/13 - 19:08:18 | 200 |  204.205903ms |  127.0.0.1 | GET      "/assets/winter.webp"
[GIN] 2023/11/13 - 19:08:21 | 200 |     207.047µs |  127.0.0.1 | GET      "/admin"
[GIN] 2023/11/13 - 19:08:22 | 200 |     534.099µs |  127.0.0.1 | GET      "/assets/css/admin.css"
[GIN] 2023/11/13 - 19:08:22 | 304 |      41.051µs |  127.0.0.1 | GET      "/js/functions.js"
[GIN] 2023/11/13 - 19:08:22 | 200 |     259.689µs |  127.0.0.1 | GET      "/js/admin.js"
[GIN] 2023/11/13 - 19:08:22 | 200 |      303.86µs |  127.0.0.1 | GET      "/js/adminFunctions.js"
2023/11/13 19:08:22 Retrieved Wrapperr version. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:22 | 200 |      599.35µs |  127.0.0.1 | POST     "/api/get/wrapperr-version"
2023/11/13 19:08:22 Retrieved Wrapperr admin state. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:22 | 200 |     139.025µs |  127.0.0.1 | POST     "/api/get/admin-state"
[GIN] 2023/11/13 - 19:08:22 | 304 |      52.922µs |  127.0.0.1 | GET      "/assets/done.svg"
2023/11/13 19:08:27 New admin account created. Server is now claimed.
[GIN] 2023/11/13 - 19:08:27 | 201 |    1.876045ms |  127.0.0.1 | POST     "/api/create/admin"
[GIN] 2023/11/13 - 19:08:27 | 200 |      66.222µs |  127.0.0.1 | GET      "/admin"
[GIN] 2023/11/13 - 19:08:27 | 304 |      58.652µs |  127.0.0.1 | GET      "/assets/css/admin.css"
[GIN] 2023/11/13 - 19:08:27 | 304 |      36.831µs |  127.0.0.1 | GET      "/js/functions.js"
[GIN] 2023/11/13 - 19:08:27 | 304 |      25.311µs |  127.0.0.1 | GET      "/js/admin.js"
[GIN] 2023/11/13 - 19:08:27 | 304 |      34.481µs |  127.0.0.1 | GET      "/js/adminFunctions.js"
2023/11/13 19:08:27 Retrieved Wrapperr version. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:27 | 200 |    1.022745ms |  127.0.0.1 | POST     "/api/get/wrapperr-version"
2023/11/13 19:08:27 Retrieved Wrapperr admin state. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:27 | 200 |      86.583µs |  127.0.0.1 | POST     "/api/get/admin-state"
[GIN] 2023/11/13 - 19:08:27 | 304 |      59.962µs |  127.0.0.1 | GET      "/assets/done.svg"
2023/11/13 19:08:29 Created and retrieved admin login JWT Token. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:29 | 200 |    2.110693ms |  127.0.0.1 | POST     "/api/login/admin"
[GIN] 2023/11/13 - 19:08:29 | 200 |      52.482µs |  127.0.0.1 | GET      "/admin"
2023/11/13 19:08:30 Retrieved Wrapperr version. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:30 | 200 |    1.866384ms |  127.0.0.1 | POST     "/api/get/wrapperr-version"
2023/11/13 19:08:30 Retrieved Wrapperr admin state. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:08:30 | 200 |      83.683µs |  127.0.0.1 | POST     "/api/get/admin-state"
2023/11/13 19:13:36 Created and retrieved admin login JWT Token. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:13:36 | 200 |    2.306439ms |  127.0.0.1 | POST     "/api/login/admin"
[GIN] 2023/11/13 - 19:13:36 | 200 |     140.055µs |  127.0.0.1 | GET      "/admin"
[GIN] 2023/11/13 - 19:13:37 | 304 |      57.362µs |  127.0.0.1 | GET      "/assets/css/admin.css"
[GIN] 2023/11/13 - 19:13:37 | 304 |      55.132µs |  127.0.0.1 | GET      "/js/functions.js"
[GIN] 2023/11/13 - 19:13:37 | 304 |      78.773µs |  127.0.0.1 | GET      "/js/adminFunctions.js"
[GIN] 2023/11/13 - 19:13:37 | 304 |      53.431µs |  127.0.0.1 | GET      "/js/admin.js"
2023/11/13 19:13:37 Retrieved Wrapperr version. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:13:37 | 200 |     949.292µs |  127.0.0.1 | POST     "/api/get/wrapperr-version"
2023/11/13 19:13:37 Retrieved Wrapperr admin state. - Origin: 127.0.0.1 
[GIN] 2023/11/13 - 19:13:37 | 200 |     335.861µs |  127.0.0.1 | POST     "/api/get/admin-state"
[GIN] 2023/11/13 - 19:13:37 | 200 |    3.233681ms |  127.0.0.1 | GET      "/assets/img/favicons/favicon.ico"
[GIN] 2023/11/13 - 19:13:37 | 304 |      59.192µs |  127.0.0.1 | GET      "/assets/done.svg"

Cloned the repo just now. Running on Linux x86. Whenever I sign in, it refreshes the page but does not log me in.

Jomack16 commented 1 year ago

I just pulled the beta as requested. The mainpage has changed for me. It now has a snowing background and a gift on the sign in section. It says 'wrapperr is not configured' in red. I click on Admin at the bottom of the screen and create an admin user account. Then when I try to login to the admin page, it fails again. This time there is no 400 error HAR file and wrapper.log attached. HAR and Log.zip

aunefyren commented 12 months ago

Hey, @Jomack16, your log file says:

2023/11/07 10:22:45 Running version v3.2.0.

Please try v3.2.1 as I mentioned above, like @AlexanderEpolite.

aunefyren commented 12 months ago

Cloned the repo just now. Running on Linux x86. Whenever I sign in, it refreshes the page but does not log me in.

@AlexanderEpolite

I think the issue is I upgraded the cookie creation function to set the cookie security to strict, which is only allowed on localhost or HTTPS traffic. So when I fixed the original bug, the login still didn't function. I am guessing/hoping you were not using either of those options for your testing.

The newest beta build/main branch has this removed, if anyone with this issue is able to test it <3

You can also confirm this by looking in the console when logging in, as it should say strict mode is not allowed on HTTP traffic.

Jomack16 commented 12 months ago

I was not using localhost or https in my testing, so that makes sense. Using the :beta tag in my docker command now. It is working! I am able to login to the admin page after creating a user.

aunefyren commented 12 months ago

Awesome @Jomack16, I will push these changes as soon as possible!

Thank you to everyone who helped resolve this.

Jeanball commented 12 months ago

Hi,

I have the same issue of @Jomack16 and when I tried with beta tag and now everything is up and running! I was using ZeroTier to reach my wrapperr instance so yeah it's explain why it's not working with strict mode enable. Thanks for your work!

aunefyren commented 12 months ago

Fixed in v3.2.1.