rest.nvim icon indicating copy to clipboard operation
rest.nvim copied to clipboard

Authorization field seems not available

Open breenbo opened this issue 1 year ago • 9 comments

Hello,

I tried a simple request, similar to the example on the repo, with a Authorization: Bearer {{TOKEN}}, but I'm not able to authenticate to the website.

The token is generated after login using rest-nvim, which is succesfull, I get a working token in the response. Even if I set the token in plain text in the Authorization field, I'm not able to authenticate. If I put the {{TOKEN}} in the url, I can see it, so setting from login and getting the TOKEN from env is working.

Seen a similar issue in a chat here, but was unable to find it again.

Thx for your awesome work.

image

image

breenbo avatar Mar 20 '24 08:03 breenbo

Have the same issues. But for me after the update, rest.nvim no longer stores the TOKEN from login, so I have to manually add it. And even if i manually add it, TOKEN from the current environment doesnt seem to work when its in the Authorization header.

(But the url arguments from the env file work).

skela avatar Mar 20 '24 15:03 skela

Hi, this is related to this comment in #308.

At the time of this writing, rest.nvim doesn't yet support Authorization headers with the new cURL implementation. It's not hard to do and it's already in progress, but there are a lot of things on the list so it may take me a day or two to push an implementation (plus the lua-curl library has no real documentation and I've been living reading the code of it 😢)

NTBBloodbath avatar Mar 20 '24 16:03 NTBBloodbath

@NTBBloodbath but i think the comment you tagged says its closed + its been pushed. However, and yes it might deserve its own issue i suppose - it does not seem to write into the .env file the way it used to following a successful login response. Like at all. The issue might be related to #308 though, as there was something wrong about loading env variables, perhaps its still got an issue finding the path to the env to write into it.

(alternatively the syntax has changed, but im pretty sure im doing it the way im supposed to)

skela avatar Mar 20 '24 18:03 skela

but i think the comment you tagged says its closed + its been pushed.

Yes, that's because that issue was initially about another behavior. I asked to open a new issue dedicated to the authentication issues after it

However, and yes it might deserve its own issue i suppose - it does not seem to write into the .env file the way it used to following a successful login response. Like at all. The issue might be related to #308 though, as there was something wrong about loading env variables, perhaps its still got an issue finding the path to the env to write into it.

(alternatively the syntax has changed, but im pretty sure im doing it the way im supposed to)

Oh, I removed that because the previous implementation had some problems, for example:

  1. It was to write or not to write, which was not configurable during runtime and was not very convenient that way
  2. It automatically rewritten existing values in the file without prior confirmation, which caused problems

In version 2.1 (which won't be far away) I'm going to reimplement it in the most intuitive, interactive and detailed way possible

NTBBloodbath avatar Mar 20 '24 18:03 NTBBloodbath

But does it mean in this current version, that it doesnt need to write the token into the env file itself, and when u run context.set_env("TOKEN","eywhatever") it keeps it in memory, something like that?

Or does it mean context.set_env doesnt do anything at the moment.

skela avatar Mar 20 '24 18:03 skela

Is there any workaround if I need to make an call where auth basic is needed?

Maybe I am missing something. But does this mean calls where Auth is needed is not supported in v2?

I have been trying to figure out why my calls are not working in rest.nvim and doubt whether it is an user issue or not.

calvinchoy avatar Apr 02 '24 18:04 calvinchoy

If there are any updates on this do mention me so i can know. I have to use a lot of Auth tokens so makes it impossible to switch.

redoxahmii avatar Apr 13 '24 03:04 redoxahmii

yeah hold on how how are auth headers not supported? I'm really excited to use rest.nvim, as I've been using roast.vim forever and this project looks awesome, but without auth is essentially useless 😢

It's especially confusing because there's an auth header in tests/, due to which I assumed it was supported

gegnew avatar Apr 16 '24 10:04 gegnew

yeah hold on how how are auth headers not supported? I'm really excited to use rest.nvim, as I've been using roast.vim forever and this project looks awesome, but without auth is essentially useless 😢

It's especially confusing because there's an auth header in tests/, due to which I assumed it was supported

Tested it already doesn't work at this point i am intrigued to actually open it myself and see why lol

redoxahmii avatar Apr 17 '24 00:04 redoxahmii

Closing this due to v3 release. Should be fixed now.

boltlessengineer avatar Aug 23 '24 14:08 boltlessengineer