ROLE_NOT_FOUND_FOR_USER (API)

I am using one NocoBase instance for two apps.

I want to access my data source through the API in the second app.

I created a role and an API token with the necessary permissions. However, when I make a request, I get a ROLE_NOT_FOUND_FOR_USER error. Why?

Did you create the API token using the API Keys plugin?
And how did you request the data in the second app? Could you please give more details?

  1. Yes. Through admin/settings/api-keys
  2. I just do request like this:
curl --location 'https://second.base.com/api/branches:list' \
--header 'Authorization: Bearer ...'

I have two apps (first and second).
First and second apps has collection “branches”
The second app has collection “groups”

I created a new API key in second app (with root permissions).
When I request branches collection (https://second.base.com/api/branches:list) I got ROLE_NOT_FOUND_FOR_USER error.

When I request “groups” collection (https://second.base.com/api/groups:list) I got 404 Not found.

Which version are you using?
Could you try using https://second.base.com/api/branches:list?token=xxx
If possible, could you try reproducing the issue on the official demo or provide a demo environment?

  • v1.5.0-beta.34

Demo: links.md · GitHub

Is http://noco2.138.201.154.163.sslip.io/ a sub-application with a custom domain?

If so, you need to include the X-Hostname header. For example:

curl 'http://noco2.138.201.154.163.sslip.io/api/branches2:list' \
    -H 'X-Hostname: noco2.138.201.154.163.sslip.io'

Thank you!