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

always show debug oauth2 request timeline button #4768

Merged
merged 2 commits into from
May 11, 2022

Conversation

dimitropoulos
Copy link
Contributor

@dimitropoulos dimitropoulos commented May 10, 2022

if this doesn't get the award for "best one-liner" I don't know what will, haha

Context

When you do OAuth2 "stuff" (in general) there are separate out-of-band calls that happen sometimes, for example to a /token endpoint to fetch your token. Of course, when using OAuth2 Authentication in Insomnia, Insomnia handles this for you. Great!

What's not great, though, is that you can't actually see that request. If you look at the timeline you see the timeline for the request corresponding to what's in your URL bar, which in this example is /client-credentials.

Screenshot_20220510_164927

The behavior before this PR

Today on the stream we were debugging #4715 but had a pretty hard time because prior to now, you could not see successful requests to the /token endpoint and the bug we were looking into related to this OAuth-specific request. Hilariously, the stream is a good example of exactly the kind of problems our users face when trying to debug such things on their own.

However, we located something of an escape hatch. You see, when you have an error in a request, just recently we added the functionality to see the timeline for the error.

It looks like this:
Screenshot_20220510_164206

What this PR changes

To solve this, we tried (and failed at a few things), but eventually noticed that if we simply render the button at all times, it will correctly show the /token request whenever it has been made (including if it's cached) and not otherwise.

Notice the button on the AFTER that reads "Response Timeline"

BEFORE AFTER
Screenshot_20220510_164148 Screenshot_20220510_164130

While from a code perspective this is a pretty minor (literal one line) change... this has pretty cool implications for users trying to investigate the OAuth calls that Insomnia makes.

The result of this is that when a user clicks this new (now, always present) button, they can see the full timeline whenever they wish:

Screenshot_20220510_210641

changelog(Improvements): adds a "Response Timeline" so that now you can see a raw timeline output of all OAuth 2 token requests

@dimitropoulos dimitropoulos self-assigned this May 11, 2022
@dimitropoulos dimitropoulos marked this pull request as ready for review May 11, 2022 01:14
Copy link
Member

@filfreire filfreire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@filfreire filfreire enabled auto-merge (squash) May 11, 2022 08:21
@filfreire filfreire merged commit 4e47da1 into Kong:develop May 11, 2022
@filfreire filfreire deleted the feat/oauth2-requests branch May 11, 2022 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants