question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OAuth2.0 populate `access_token` to env

See original GitHub issue

Is your feature request related to a problem? Please describe. I am using the OAuth2 auth tab and love the tooling around refreshing, adding scopes, encoding helpers.

However for all the other routes - we use Authorization: Bearer #{access_ token} tab like most OAuth2 API’s once the token_set is generated you only need the JWT.

This requires copy & pasting the access_token back into the environment which is shared across my whole workspace and all other API calls.

Describe the solution you’d like I know it is possible to setup OAuth2 flow manually and chain the access_token back into my env var: https://support.insomnia.rest/article/43-chaining-requests - But if we go this route, we loose the convenience of the OAuth2.0 tab refresh & client id/secret helpers.

It would be great to have the ability to set the access_token in the shared environment after a successful access/refresh generation

Describe alternatives you’ve considered Request chaining

Additional context Let me know if this is on the radar, or if there is another workaround I haven’t considered

OA2 helper Tab

Manually refresh and copy paste new token set when you need to interact w/ api Screen Shot 2020-08-10 at 1 11 11 PM

ENV Var

Variable where we store (copy/paste) recently generated access token Screen Shot 2020-08-07 at 10 24 11 AM

Header

All other API requests that don’t need the OA2 tab, but just the Authorization: Bearer #{access_token} header Screen Shot 2020-08-10 at 1 11 46 PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
dmythrocommented, Sep 11, 2020

Oh, that would be awesome and a completely automated flow for me!

0reactions
SerKnightcommented, May 10, 2021

Beautiful - Thank you to the developer and for updating the thread…

Note that I did have to change the oA2 token url which is based on the providers token POST base url, not the callabck URL. In my case it matched the alternative example in the readme:

https://identity.xero.com/connect/token so in your environment you put

"oauth2_token_url_suffix": "connect/token"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature request: Save access token to Environment variable ...
I'd love an automated way to handle changing the OAuth token per env. I've got the Get New Access Token screen all populated...
Read more >
Setting up the Environment - OAuth 2.0 Simplified
Create a new folder and create an empty file in that folder called index.php . From the command line, run php -S localhost:8000...
Read more >
How to automatically set OAuth 2.0 Access Token as variable
As of now, the only way to do this is as you described, generate an access token, copy-paste it into a variable and...
Read more >
Oauth2.0: Validity of access tokens across environ...
Essentially that means the access token can be generated in any environment. But it's validity is based on the fact for which environments,...
Read more >
Using OAuth2 how do I pull the access token into a variable?
Create an environment variable · For the value of the variable, use the Response => Body Attribute and under Filter (JSONPath or XPath),...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found