Problem with global auth token in IntelliJ context
See original GitHub issueHi,
The IntelliJ HTTP Client plugin keeps client.global env parameters between runs. httpyac doesn’t it seems?
We have a setup in our structure where we have a login job setup:
### User Login
POST {{auth0_base_url}}/oauth/token
Content-Type: application/json
{
"client_id": "{{user_auth_client_id}}",
"client_secret": "{{user_auth_client_secret}}",
"grant_type": "http://someauth.com/realm",
"username": "{{user_auth_username}}",
"password": "{{user_auth_password}}",
"audience": "an/audience",
"realm": "Username-Password-Authentication",
"scope": "openid"
}
> ./login.js
with a script like this:
client.test('Token retrieved successfully', function () {
client.assert(response.status === 200, 'Response status is not 200')
var access = response.body.access_token
if (access) {
client.global.set('user_access_token', access)
}
})
This user_access_token
is stored globally in the IntelliJ plugin in a way where this env parameter is available to requests that are executed later.
So, If I run:
### List companies
GET {{my_base_url}}/api/companies
Authorization: Bearer {{user_access_token}}
it will work just fine. But If I do this in httpyac, I get the error:
...ReferenceError: user_access_token is not defined at Object.userJS...
So, my questions are:
- Is this intended behaviour?
- Do you have a suggestions on how I could solve this scenario for httpyac, without breaking this logic within IntelliJ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Resolved: Problem with GitHub token authentication
Using PhpStorm 2017.3.4, I'm trying to follow the instructions at https://intellij-support.jetbrains.com/hc/en-us/articles/206537004 ...
Read more >Support token capturing for an authentication by JWT - YouTrack
Now it's possible to execute authorization request, copy token from a response and paste it into a variable or next request. It's tedious...
Read more >HTTP Client file not reading environment variables
Deleting and recreating the http-client.private.env.json file and restarting the IDE; Using a http-client.env.json file instead (and restarting ...
Read more >Manage tasks and contexts | IntelliJ IDEA Documentation
Integrate your issue tracker in IntelliJ IDEA. Open, update, and close tickets, track the time you spend on a task right from the...
Read more >Exploring the HTTP request syntax | IntelliJ IDEA Documentation
In the Java context, you can use code completion Ctrl+Space to specify ... Basic authentication GET http://example.com Authorization: Basic ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the --interactive fix is not needed in VS Code plugin. The intellij variables are cached as long as my extension is active and therefore it should just work there now. Prerequisite is the version 2.5.0
AND: Thank you for sharing this tool with us! It is so cool and a great timesaver… 😃