Login loop with first login. #120

Closed
opened 2025-09-11 12:04:33 -05:00 by DENightOne · 9 comments
DENightOne commented 2025-09-11 12:04:33 -05:00 (Migrated from github.com)

Have no idea why but I am going a login loop with first login, I run docker compose up and I see the database starting and configuring without error, then I see the frontend starting without error... auth_admin and its one time password are showing when I try to log into the frontend it just loops back to the login page without doing anything. and the "admin panel" is not shown. When I try a completely random login I get an error saying invalid username or password....so I am sure its doing something. when I try auth_admin with a random password I also get invalid username or password. I have tried firefox and edge and get the same.

When I look at the logs all i get is listening on port 3000.

Is there any way to enable verbose logging so that I can at least see what is happening when I login? if I look at the dev console in firefox and edge I get no errors related to login

Have no idea why but I am going a login loop with first login, I run docker compose up and I see the database starting and configuring without error, then I see the frontend starting without error... auth_admin and its one time password are showing when I try to log into the frontend it just loops back to the login page without doing anything. and the "admin panel" is not shown. When I try a completely random login I get an error saying invalid username or password....so I am sure its doing something. when I try auth_admin with a random password I also get invalid username or password. I have tried firefox and edge and get the same. When I look at the logs all i get is listening on port 3000. Is there any way to enable verbose logging so that I can at least see what is happening when I login? if I look at the dev console in firefox and edge I get no errors related to login
DENightOne commented 2025-09-11 12:41:32 -05:00 (Migrated from github.com)

not sure if this is the cause.... took the exact same docker compose file and run on an external VPS
the login loop is only on my homelab internal domain https://void.internal this one login loops (internal trusted cert)

The external VPS domain is https://void.*******.duckdns.org and that works fine. (Lets Encrypt Cert)

they are both behind a caddy server reverse proxy

not sure if this is the cause.... took the exact same docker compose file and run on an external VPS the login loop is only on my homelab internal domain https://void.internal this one login loops (internal trusted cert) The external VPS domain is https://void.*******.duckdns.org and that works fine. (Lets Encrypt Cert) they are both behind a caddy server reverse proxy
notquitenothing commented 2025-09-11 16:59:58 -05:00 (Migrated from github.com)

Since it is looping for your internal domain only, my first thought is to make sure your APP_URL environment variable is set exactly how you reach it in the browser. It should include the protocol and have no trailing slash. I think in your case APP_URL: https://void.internal

My second thought would be to check what the last redirect was from VoidAuth before you ended up back at login. You should be able to check in the Network tab for the last few entries with status 302 or 303, and see what the 'Location' headers are on those requests. Having those would help me figure out what is going wrong. I will attach a screenshot showing a successful login, let me know if you would like help with this debugging step:

If the last redirect is as shown in the screenshot, https://voidauth.internal/api/cb to https://voidauth.internal/ then the problem is something else.

Since it is looping for your internal domain only, my first thought is to make sure your APP_URL environment variable is set exactly how you reach it in the browser. It should include the protocol and have no trailing slash. I think in your case `APP_URL: https://void.internal` My second thought would be to check what the last redirect was from VoidAuth before you ended up back at login. You should be able to check in the Network tab for the last few entries with status 302 or 303, and see what the 'Location' headers are on those requests. Having those would help me figure out what is going wrong. I will attach a screenshot showing a successful login, let me know if you would like help with this debugging step: <img width="680" src="https://github.com/user-attachments/assets/76e4be4e-ee34-434f-877c-d6e9741f0898" /> If the last redirect is as shown in the screenshot, `https://voidauth.internal/api/cb` to `https://voidauth.internal/` then the problem is something else.
notquitenothing commented 2025-09-11 20:49:34 -05:00 (Migrated from github.com)

Though before doing any fancy debugging, try changing your voidauth version in your docker compose yaml to :edge from :latest. I have done some work on redirects and APP_URL parsing that could possibly fix your issue. If that works please let me know
voidauth/voidauth:edge

Though before doing any fancy debugging, try changing your voidauth version in your docker compose yaml to `:edge` from `:latest`. I have done some work on redirects and APP_URL parsing that could possibly fix your issue. If that works please let me know `voidauth/voidauth:edge`
DENightOne commented 2025-09-12 06:19:07 -05:00 (Migrated from github.com)

Thanks for looking into this, I tried again last night and got a very weird result....I tried in firefox and got the same result, then with the dev console open I tried in edge and it worked....it let me login for the first time, so i change the password and saved, change the username and saved then I created a passkey and saved....I then logged out and tried to login again.. and everything failed, new password failed, passkey failed....I was back to exactly the same login loop....I then deleted all the config and db and tried again doing the exact same thing as before...login loop...This morning I tried the edge version and still get the same thing.

Image Image

as you can see in the console view this is straight after a login....I get a bunch of 304...then it shows me in the console 401 error at the page https://void.internal/api/user/me.

The fact that is worked properly once really messes with my mind and it makes no sense as to why it would work once.

I am going to quickly build another fresh docker vm and try the same config on that...there might be something on unique to my old docker server that is causing a problem. I will let you know how it goes

Thanks for looking into this, I tried again last night and got a very weird result....I tried in firefox and got the same result, then with the dev console open I tried in edge and it worked....it let me login for the first time, so i change the password and saved, change the username and saved then I created a passkey and saved....I then logged out and tried to login again.. and everything failed, new password failed, passkey failed....I was back to exactly the same login loop....I then deleted all the config and db and tried again doing the exact same thing as before...login loop...This morning I tried the edge version and still get the same thing. <img width="2560" height="1353" alt="Image" src="https://github.com/user-attachments/assets/13a7f10b-7295-4890-a3dc-171099a10f98" /> <img width="1013" height="444" alt="Image" src="https://github.com/user-attachments/assets/66639ced-0a7d-418e-bec0-7e0caed5c6ed" /> as you can see in the console view this is straight after a login....I get a bunch of 304...then it shows me in the console 401 error at the page https://void.internal/api/user/me. The fact that is worked properly once really messes with my mind and it makes no sense as to why it would work once. I am going to quickly build another fresh docker vm and try the same config on that...there might be something on unique to my old docker server that is causing a problem. I will let you know how it goes
DENightOne commented 2025-09-12 06:39:41 -05:00 (Migrated from github.com)

I am now sure that this is pretty much a "me" problem and not something with your code....I have just build a new docker server on proxmox copied over the compose file as is, made no changes and it works as documented. I still cant get my head around why it would work once....but instead of spending days trying to figure it out just going to stay on new docker server. In fact I am inspired to move all my other containers over to the new server, nothing better then a clean start with docker. (my old docker host is about 7 years old with nothing but updates..! ). Thanks again for a great project and your help.

I am now sure that this is pretty much a "me" problem and not something with your code....I have just build a new docker server on proxmox copied over the compose file as is, made no changes and it works as documented. I still cant get my head around why it would work once....but instead of spending days trying to figure it out just going to stay on new docker server. In fact I am inspired to move all my other containers over to the new server, nothing better then a clean start with docker. (my old docker host is about 7 years old with nothing but updates..! ). Thanks again for a great project and your help.
notquitenothing commented 2025-09-12 07:23:52 -05:00 (Migrated from github.com)

Nice! Glad you got it working, even though it is unknown why it wouldn't work on your original setup. I am going to close this, but if you run into anything feel free to open another issue

Nice! Glad you got it working, even though it is unknown why it wouldn't work on your original setup. I am going to close this, but if you run into anything feel free to open another issue
eeble commented 2025-11-05 20:47:35 -06:00 (Migrated from github.com)

I am actually going through this currently and have nearly the same symptoms. It was working great and then it stopped.
If I use an incorrect password/username it tells me as such, but if I use a correct username/password it just drops me back at the login page.
I am running in kubernetes with the following deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: voidauth-deployment
  namespace: apps
spec:
  replicas: 1 # Number of desired replicas
  selector:
    matchLabels:
      app: voidauth
  template:
    metadata:
      labels:
        app: voidauth
    spec:
      containers:
      - name: voidauth-container
        image: voidauth/voidauth:edge #tried after seeing your post above, it didn't change anything that I could tell
        ports:
        - containerPort: 3000 # Replace with your application's port
        env:
        - name: APP_URL
          value: https://void.mydomain.net
        - name: STORAGE_KEY
          valueFrom: 
            secretKeyRef:
              name: voidauth-storage-key
              key: key
        - name: DB_NAME
          valueFrom:
            secretKeyRef:
              name: voidauth-db-app
              key: dbname
        - name: DB_USER
          valueFrom:
            secretKeyRef:
              name: voidauth-db-app
              key: username
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              name: voidauth-db-app
              key: password
        - name: DB_HOST
          valueFrom:
            secretKeyRef:
              name: voidauth-db-app
              key: host
        - name: SMTP_HOST
          valueFrom:
            configMapKeyRef:
              name: smtp-config
              key: SMTP_HOST
        - name: SMTP_FROM
          value: voidauth@mydomain.net
        - name: SMTP_PORT
          valueFrom:
            configMapKeyRef:
              name: smtp-config
              key: SMTP_PORT
        - name: SMTP_SECURE
          value: "true"
        - name: SMTP_USER
          valueFrom:
            secretKeyRef:
              name: smtp-creds
              key: SMTP_USERNAME
        - name: SMTP_PASS
          valueFrom:
            secretKeyRef:
              name: smtp-creds
              key: SMTP_PASSWORD
        volumeMounts:
        - name: voidauth-storage
          mountPath: /persist
      volumes:
      - name: voidauth-storage
        persistentVolumeClaim:
          claimName: voidauth-pvc

and the database is cnpg. Again, it was working fine until tonight when I tried to log into forgejo using VoidAuth and it just kept looping back to the login page.

Image
I am actually going through this currently and have nearly the same symptoms. It was working great and then it stopped. If I use an incorrect password/username it tells me as such, but if I use a correct username/password it just drops me back at the login page. I am running in kubernetes with the following deployment: ``` apiVersion: apps/v1 kind: Deployment metadata: name: voidauth-deployment namespace: apps spec: replicas: 1 # Number of desired replicas selector: matchLabels: app: voidauth template: metadata: labels: app: voidauth spec: containers: - name: voidauth-container image: voidauth/voidauth:edge #tried after seeing your post above, it didn't change anything that I could tell ports: - containerPort: 3000 # Replace with your application's port env: - name: APP_URL value: https://void.mydomain.net - name: STORAGE_KEY valueFrom: secretKeyRef: name: voidauth-storage-key key: key - name: DB_NAME valueFrom: secretKeyRef: name: voidauth-db-app key: dbname - name: DB_USER valueFrom: secretKeyRef: name: voidauth-db-app key: username - name: DB_PASSWORD valueFrom: secretKeyRef: name: voidauth-db-app key: password - name: DB_HOST valueFrom: secretKeyRef: name: voidauth-db-app key: host - name: SMTP_HOST valueFrom: configMapKeyRef: name: smtp-config key: SMTP_HOST - name: SMTP_FROM value: voidauth@mydomain.net - name: SMTP_PORT valueFrom: configMapKeyRef: name: smtp-config key: SMTP_PORT - name: SMTP_SECURE value: "true" - name: SMTP_USER valueFrom: secretKeyRef: name: smtp-creds key: SMTP_USERNAME - name: SMTP_PASS valueFrom: secretKeyRef: name: smtp-creds key: SMTP_PASSWORD volumeMounts: - name: voidauth-storage mountPath: /persist volumes: - name: voidauth-storage persistentVolumeClaim: claimName: voidauth-pvc ``` and the database is cnpg. Again, it was working fine until tonight when I tried to log into forgejo using VoidAuth and it just kept looping back to the login page. <img width="2560" height="721" alt="Image" src="https://github.com/user-attachments/assets/4ad52c78-f536-4cac-a9d2-4b054dd32e23" />
eeble commented 2025-11-05 21:12:07 -06:00 (Migrated from github.com)

In a moment of pulling myself out of the rabbit hole, I decided to try some other systems... and they all work just fine. So this is definitely a browser issue. I'll post back if I figure out what it was as I still think it was likely related to the initial issue.

edit: Looks like even though I cleared out the storage using the developer tools, there was another domain cookie somewhere that was mucking things up. after clearing out ALL of the cookies for my domain, it's back to normal.

In a moment of pulling myself out of the rabbit hole, I decided to try some other systems... and they all work just fine. So this is definitely a browser issue. I'll post back if I figure out what it was as I still think it was likely related to the initial issue. edit: Looks like even though I cleared out the storage using the developer tools, there was another domain cookie somewhere that was mucking things up. after clearing out ALL of the cookies for my domain, it's back to normal.
llnext commented 2026-01-12 08:19:53 -06:00 (Migrated from github.com)

I also encountered this problem, with the same 401 error from the same API. Strangely, only one computer had this issue; the other computer and phone worked perfectly. It might be related to cookies, but this hasn't been verified yet.

I also encountered this problem, with the same 401 error from the same API. Strangely, only one computer had this issue; the other computer and phone worked perfectly. It might be related to cookies, but this hasn't been verified yet.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
adam/gate#120
No description provided.