Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong pocketbase auth token when you restart anew the containers #29

Open
Pablo1107 opened this issue Oct 27, 2024 · 1 comment
Open

Comments

@Pablo1107
Copy link

If you erase all the containers and volumes and start anew, the old token is saved as cookie in the browser and you get this error:

Auth state after loading cookie: true
Auth token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MzEyMTYyNTMsImlkIjoiZnRmamcweHBrMm5hZTNkIiwidHlwZSI6ImFkbWluIn0.PBxn6jvwPlENoBD-W8T5beUFztSes2aBkQOofG4jf1c
ClientResponseError 401: The request requires valid admin authorization token to be set.
    at file:///app/node_modules/pocketbase/dist/pocketbase.es.mjs:1:32687
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async configuration (file:///app/build/server/chunks/hooks.server-dE1o57EC.js:94:23)
    at async authentication (file:///app/build/server/chunks/hooks.server-dE1o57EC.js:83:20)
    at async respond (file:///app/build/server/index.js:3859:22)
    at async Array.ssr (file:///app/build/handler.js:1272:3) {
  url: 'http://pocketbase:8080/api/collections?page=1&perPage=500&skipTotal=1',
  status: 401,
  response: {
    code: 401,
    message: 'The request requires valid admin authorization token to be set.',
    data: {}
  },
  isAbort: false,
  originalError: {
    url: 'http://pocketbase:8080/api/collections?page=1&perPage=500&skipTotal=1',
    status: 401,
    data: {
      code: 401,
      message: 'The request requires valid admin authorization token to be set.',
      data: {}
    }
  }
}

The workaround for this is to erase the cookies from the browser and refresh the page.

Maybe this can be fixed by getting a new token if the one saved fails like this.

@rishikanthc
Copy link
Owner

rishikanthc commented Oct 31, 2024

Yeah, I'm aware of this. I'll fix this in the next release. It has actually been a major annoyance during development. Apologies for the bug. I know it's quite inconvenient to do this again and again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants