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

OAUTH2 auth is successful but token endpoint is returned instead of api endpoint #1999

Open
wmlele opened this issue Apr 3, 2024 · 12 comments · May be fixed by #2061 or #2077
Open

OAUTH2 auth is successful but token endpoint is returned instead of api endpoint #1999

wmlele opened this issue Apr 3, 2024 · 12 comments · May be fixed by #2061 or #2077
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@wmlele
Copy link

wmlele commented Apr 3, 2024

Hello,

trying to access an OAUTH2/OIDC protected endpoint, but the Response contains the output on the OAUTH Token request, instead of the protected API endpoint (which is never called despite a successful oauth):

Screenshot from 2024-04-03 17-51-33-1

The {{oidc_issuer}}/me (userinfo) endpoint is never called, the output is from the successfull call to /token

This is what insomnia returns for the exact same configuration

Screenshot from 2024-04-03 17-51-44-1

Not sure if it's a mistake on my side or something different from my expectations.

Thanks

@guilhermeferrari
Copy link

+1

@diogenesc
Copy link

Facing the same issue here

@wmlele
Copy link
Author

wmlele commented Apr 4, 2024

Just a follow up on this. Of course you can use bruno for an oauth/oidc protected api endpoint.
Just define an empty request with oauth2 authentication, and store the access_token as a variable, then just do a bearer token auth on the actual APIs using the stored access_token.
Not sure though this is the way it was intended?

@diogenesc
Copy link

Just a follow up on this. Of course you can use bruno for an oauth/oidc protected api endpoint. Just define an empty request with oauth2 authentication, and store the access_token as a variable, then just do a bearer token auth on the actual APIs using the stored access_token. Not sure though this is the way it was intended?

Probably not, seems wrong if we think how others API clients works.

@sanjai0py sanjai0py added bug Something isn't working help wanted Extra attention is needed labels Apr 5, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 11, 2024
@pietrygamat pietrygamat linked a pull request Apr 11, 2024 that will close this issue
5 tasks
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
…Token action

The actual the authorization request is part of request preparation

usebruno#1999
usebruno#1003
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
…ble by scripts

The new variable 'credentials' is now available in 'req' object. It is added automatically during request preparation if oauth2 method is used and is value is either evaluated or retrieved from collection oauth2 cache.

usebruno#1999
usebruno#1003
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 14, 2024
…Token action

The actual the authorization request is part of request preparation

usebruno#1999
usebruno#1003
@pietrygamat pietrygamat linked a pull request Apr 14, 2024 that will close this issue
5 tasks
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 15, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 15, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 15, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 15, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 16, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
@ryanholden8
Copy link

Any update on this? Seems this is a confirmed bug based on all the referencing from #2148?

@diogenesc
Copy link

+1

pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 5, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
@WiredNerd
Copy link

+1
This is one of the issues preventing my team from adopting Bruno

@nmartinon
Copy link

+1 My team also just can't use bruno because of this

pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 6, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 7, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 7, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 7, 2024
… of api endpoint

Setting oauth2 authorization no longer equals overwriting user-specified data in a request. The pre-requests made to obtain oauth2 access_token are now separated from actual API request.

usebruno#1999
@fekitibi
Copy link

fekitibi commented May 8, 2024

+1

@deinspanjer
Copy link

I'm really excited with the potential of Bruno here but I'm running into the same issue.
If I try to set up Oauth2 as the auth directly in a request, the actual request doesn't go through, only the token issuing request.

If I try to set up Oauth2 at the collection level, and set a request to inherit, I see the note:
Note: You need to use scripting to set the access token in the request headers.

But I'm not sure how exactly to do that.
Does the Collection's oauth get automatically called first?
Where is the access token from the collection stored so I can do something with it?

@lord-haffi
Copy link

lord-haffi commented May 11, 2024

+1
Currently I'm using this workaround (for anybody who didn't find it): #1704 (comment)

@markwimpory
Copy link

this seems a bit mad. BIG oneup from me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet