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

Authorization field seems not available #316

Open
breenbo opened this issue Mar 20, 2024 · 9 comments
Open

Authorization field seems not available #316

breenbo opened this issue Mar 20, 2024 · 9 comments
Labels
v2 rest.nvim v2 issues

Comments

@breenbo
Copy link

breenbo commented Mar 20, 2024

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

@skela
Copy link

skela commented Mar 20, 2024

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).

@NTBBloodbath
Copy link
Member

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 NTBBloodbath added the v2 rest.nvim v2 issues label Mar 20, 2024
@skela
Copy link

skela commented Mar 20, 2024

@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)

@NTBBloodbath
Copy link
Member

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

@skela
Copy link

skela commented Mar 20, 2024

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.

@calvinchoy
Copy link

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.

@Redoxahmii
Copy link
Contributor

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.

@gegnew
Copy link

gegnew commented Apr 16, 2024

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

@Redoxahmii
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 rest.nvim v2 issues
Projects
None yet
Development

No branches or pull requests

6 participants