superset: Endpoint /api/me/roles returns 401 "Not authorized" despite valid access token

I am running Superset 3.0.0 with Docker Compose. Trying to access the following API endpoint:

/api/me/roles

I have created an access token from /api/v1/security/login for a user with the Admin, Public and Gamma roles. I make a request for the mentioned API endpoint with the appropriate header.

Authorization: Bearer {access-token}
Accept: application/json

Various endpoints return 200 and a valid JSON payload, such as /api/v1/dashboard and /api/v1/chart. However, the /api/me/roles endpoint returns 401 “Not authorized”. This blocks the embedded dashboard feature. Could this be a bug, or am I doing something wrong? I sense there is something special with this endpoint and authentication as it relates to the currently authenticated user.

The /api/me/roles endpoint returns the roles when I log in through the UI and load the endpoint in a web browser.

Expected results

I expect the roles to be returned from the API with 200 OK status.

Actual results

The endpoint returns 401 “Not authorized” despite the access token seemingly being valid.

Environment

(please complete the following information):

  • Chrome latest.
  • Linux Ubuntu 22.04.
  • Superset 3.0.0 on Docker Compose in production mode

Flags

WTF_CSRF_ENABLED = False
TALISMAN_ENABLED = False
ENABLE_CORS = True

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Still happening in 3.1.1, also blocking usage of embedded dashboards. Unfortunately the workaround above won’t work because the embed SDK won’t do that for me

@mortenesbensen when you say it “wasn’t formatted correctly” what was the issue? I think we’re running into this same issue now.

Still happening in 3.0.1

@rusackas I’m still experiencing this in 4.1.1 and 5.0.0rc2. I’m using the sdk and successfully creating a guest token directly in my app signed with the secret set in configuration variable GUEST_TOKEN_JWT_SECRET. I’ve checked all the tokens and they are all valid and working and the embed partially works…it pulls lots of js and css files using the token but then the embed just shows “Something went wrong with embedded authentication. Check the dev console for details.” Checking the dev console shows what others report: A 401 returned when calling to /api/v1/me/roles. I’ve tried many solutions and none have worked for me.

Hi,

I’m also seeing this on Superset 3.1.0 when trying to embed dashboards using the embedded sdk. Any updates?

Thanks in advance

Turns out guest token I was using wasn’t formatted correct in which case the Embedded SDK successfully creates the dashboard just to fail on the subsequent call to /roles