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

OAuth 2.0 Grant Type Authorization: "invalid_client" error / URL Encode of Client ID for vertical bar #2115

Closed
2 tasks done
mrl-sap opened this issue Apr 18, 2024 · 0 comments · Fixed by #2129
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@mrl-sap
Copy link

mrl-sap commented Apr 18, 2024

I have checked the following:

  • I use the newest version of bruno.
  • I've searched existing issues and found nothing related to my issue.

Describe the bug

I want to use OAuth 2.0 with Grant Type Authorization Code in Collection level. I am using bruno v1.13.1.

The following setup works with PostMan but I have 2 issues which might be related:

  • For testing I just use a "dummy" Callback URL http://localhost. There is no handler on localhost (the connection is refused), however, this can be ignored since I only need the code that is passed as parameter with the redirect to the callback.
  • The Client ID I need to use includes the character "|" (vertical bar).

The issues I see:

  1. If I just use the Client ID as is, the Authorization Window shows "HTTP Status 400 - Bad Request". If I URL encode the vertical bar (%7C) this Authorization Window correctly shows the IDP login.
  2. However, using this escaped Client ID, after logon to the IDP, Bruno shows a small error message "invalid_client". I am not sure if this is due to the "dummy" callback (http://localhost) or because of the escaped client ID.

As said, this setup works fine with PostMan and I can simulate this manually:

  1. I open https://<authorization server>/oauth/authorize?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%2F&client_id=<url encoded client id> in my browser. This forwards me to the IDP, where I can log on and after logon I get forwarded to http://localhost/?code=<authorization code>. This will show "Connection refused" in the browser because I have nothing running on localhost. But this does not matter, I only need the parameter .
  2. POST https://<authorization server>/oauth/token?grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%2F&code=<authorization code> with Basic authorization using client id / client secret. This returns a valid JWT token.

My expectation would be that this also runs in bruno without url encoding the client ID and without the invalid_client error.

.bru file to reproduce the bug

No response

Screenshots/Live demo link

Used configuration:
Screenshot_Configuration

Authorization Window if vertical bar in Client ID is not URL-encoded:
Screenshot_BadRequest-VerticalBarNotEncoded

Error after IDP logon if Client ID is URL-encoded:
Screenshot_InvalidClient

@mrl-sap mrl-sap added the bug Something isn't working label Apr 18, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Apr 18, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue May 22, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jun 2, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jun 5, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jun 21, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jul 2, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jul 15, 2024
pietrygamat added a commit to pietrygamat/bruno that referenced this issue Jul 19, 2024
lohxt1 pushed a commit that referenced this issue Jul 26, 2024
jwetzell pushed a commit to jwetzell/bruno that referenced this issue Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant