Skip to content

[Bug]: Something is up with authorization on the OpenAPI data sources #255

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

Closed
1 task done
LennardF1989 opened this issue Jul 2, 2023 · 4 comments
Closed
1 task done
Assignees
Labels
Bug Something isn't working Needs triage Needs to be reviewed by core team

Comments

@LennardF1989
Copy link

LennardF1989 commented Jul 2, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I've tried two OpenAPI specs:

No matter the values I tried, I could never get the API's to properly authenticate. Whereas if I use the plain REST API and setup the authorization headers accordingly, the endpoint work fine.

Expected Behavior

The API's actually authenticate properly depending on their type.

Steps to reproduce

Use the above OpenAPI specs, or find something else you as a developer have access to, and try to get the different types of authorization to work.

Environment

No response

Additional Information

I've tried to go through the code and see if I could spot something glaringly wrong. I couldn't, but I have a feeling the authorization headers aren't properly set on the fetch-request. That said, I will see if I can inspect it using the Inspector... Nope.

@LennardF1989 LennardF1989 added Bug Something isn't working Needs triage Needs to be reviewed by core team labels Jul 2, 2023
@FalkWolsky FalkWolsky self-assigned this Jul 6, 2023
@FalkWolsky FalkWolsky moved this to 🆕 New in Lowcoder Jul 6, 2023
@FalkWolsky
Copy link
Contributor

As we worked heavy on OAuth (Generic Provider), these issues should be solved now.
If they remain problematic for you - please just re-open the issue.

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Lowcoder Jul 21, 2024
@Insomniacnomis
Copy link

I have this issue in my instance, being unable to access the API with an API key.
Giving the API key as an "Authorization" header, the call is returned as if no user is logged in.

As an example, running the following curl command:

curl \
	--location 'http://<DOMAIN>//api/users/me' \
	--header 'Accept: */*' \
	--header 'Authorization: ey...<REST OF THE API KEY>'

Returns as if the user is anonymous:

{"code":1,"message":"","data":{
   "id":null,
   "orgAndRoles":null,
   "currentOrgId":null,
   "username":"anonymous",
   "connections":null,
   "uiLanguage":"en",
   "avatar":null,
   "avatarUrl":null,
   "hasPassword":false,
   "hasSetNickname":false,
   "hasShownNewUserGuidance":false,
   "userStatus":null,
   "createdTimeMs":0,
   "ip":"X.X.X.X",
   "enabled":false,
   "anonymous":true,
   "orgDev":false,
   "isAnonymous":true,
   "isEnabled":false},
"success":true}

@FalkWolsky
Copy link
Contributor

The reason is a "missing" Bearer word before the actual Token.
It should be --header 'Authorization: Bearer ey...'

Screenshot 2024-09-05 at 22 15 37

@Insomniacnomis
Copy link

The reason is a "missing" Bearer word before the actual Token. It should be --header 'Authorization: Bearer ey...'
Screenshot 2024-09-05 at 22 15 37

I have tried it with and without Bearer, and the result is still the same. And a bunch of other combinations with the same result
Also, I am now checking that the cookie method isn't working either; neither with the cookie obtained with the API login (funny, that one does seem to work) nor a cookie copied from my web browser logged session.

I am running on Docker the version 2.4 if that matters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Needs triage Needs to be reviewed by core team
Projects
Status: Done
Development

No branches or pull requests

3 participants