payload icon indicating copy to clipboard operation
payload copied to clipboard

Unable to login with accounts role=user at multi tenant example

Open janybravo opened this issue 1 year ago • 2 comments

Link to reproduction

No response

Describe the Bug

Logging as [email protected] at http://abc.localhost.com:3003/admin displays message:

Unauthorized, you must be logged in to make this request.

You are not allowed to access this page.

<Button>Log out</Button>

as [email protected] at http://abc.localhost.com:3000/admin/login seems to show dashboard correctly.

And thanks for all of your AMAZING work!

To Reproduce

  1. Setup mongo docker container
  2. cd to multi-tenant example code from v2.11.2 tag.
  3. Run commands as instructed in README.md
  4. Setup /etc/hosts with abc.localhost.com pointing to 127.0.0.1
  5. Try to login with [email protected] on localhost:3000 - all good.
  6. Click Log out, Click log back in.
  7. Try to login with [email protected] on abc.localhost.com:3000 - all good, access scoped well.
  8. Click Log out, Click log back in.
  9. Try to login with [email protected] on abc.localhost.com:3000 - shows "Unauthroized" message.

Payload Version

2.11.2

Adapters and Plugins

No response

janybravo avatar Mar 08 '24 08:03 janybravo

This is expected behavior, though the error message is confusing. Non-admin users (like [email protected]) should not be able to access the admin UI which is why there is an error message. Logging-in with this account shows the message "Unauthorized, you must be logged in to make this request", however, this is misleading because the user is actually logged-in and calls to the API are successful (within the scope of their tenant permissions), it's just that they are not authorized to view the admin page.

cweseloh avatar May 08 '24 15:05 cweseloh

Yeah the example does seem slightly confusing on what the use-case is for the ‘user’ role. As the demo is, its just for doing API calls pretty much. Not to access the GUI.

Djboy08 avatar May 19 '24 23:05 Djboy08