neocodeium icon indicating copy to clipboard operation
neocodeium copied to clipboard

Shipping broken, api key doesn't work

Open s1nistr4 opened this issue 1 year ago • 13 comments

👎 Problem

When you enter an API key it gives a bunch of garbled text and says it's invalid even when it's not

🔢 Steps to reproduce

  • Install using instructions in readme with lazy.nvim
  • After it extracts binary, you have to enter the token
  • When you enter the token, it says it's invalid

👍 Expected behavior

For the token to be valid

Neovim version (nvim -v)

0.11.0-dev

Operating system (uname -om)

Linux x86_64

:checkhealth neocodeium

OK

Relevant log output

No response

s1nistr4 avatar Jun 09 '24 18:06 s1nistr4

Can't reproduce following reproducing steps. Are you sure you have invoked :NeoCodeium auth to retrieve the token?

Without more information and description of the issue (screenshots, full error log (not some "a bunch of garbled text") there would not be any fix.

monkoose avatar Jun 10 '24 06:06 monkoose

I think I have a similar issue, here's what it says: Everything works seems to properly with the original Codeium plugin, however.

  Warn  12:25:27 notify.warn NeoCodeium: Unexpected response: ]10;rgb:c0caf5\]11;rgb:24283b\]12;7\{"api_key":"string-of-letters-that-is-probably-my-api-key","name":"my-name"}
  Error  12:25:37 notify.error NeoCodeium: could not retrieve api key
Authentication is canceled

Also, a note: when using this inside of WSL, wslview (sudo apt install wslu) is needed to open the authentication link properly. Otherwise, vim.ui.open() strangely spawns explorer instead of a browser window.

n-crespo avatar Jul 18 '24 16:07 n-crespo

I found (somewhat) of a solution for this: manually enter the API key into ~/.codeium/config.json. The file should look like this:

{ "api_key": "your-api-key"}

Not pretty, but it works.

n-crespo avatar Jul 21 '24 22:07 n-crespo

Can confirm , This issue is still there.

NeoVim Version : NVIM v0.10.1 Build type: Release LuaJIT 2.1.1713484068 Run "nvim -V1 -v" for more info

After installing the plugin and entering : NeoCodeium auth , It correctly opens up the token page in the browser , but when that token is pasted in the terminal , it shows it as an invalid token.

image

image

image

image

Arpit-Moga avatar Aug 15 '24 10:08 Arpit-Moga

@Arpit-Moga which OS do you use?

monkoose avatar Aug 15 '24 11:08 monkoose

@Arpit-Moga which OS do you use?

Windows 11

image

Arpit-Moga avatar Aug 15 '24 11:08 Arpit-Moga

Thanks. Do you use WSL? Not sure about OP (because he is using Linux and my guess he had some unrelated issue), but seems like something is broken on windows based on yours and @n-crespo responces. Let me see what I can do (not an Windows user myself).

monkoose avatar Aug 15 '24 11:08 monkoose

@monkoose No , I do have WSL install but I am using Neovim on windows

Arpit-Moga avatar Aug 15 '24 11:08 Arpit-Moga

@Arpit-Moga @n-crespo could you test if it works now?

monkoose avatar Aug 15 '24 18:08 monkoose

@monkoose It works perfectly now ! Thanks for the quick update.

Arpit-Moga avatar Aug 15 '24 18:08 Arpit-Moga

Still not working in WSL for me... getting the same error:

NeoCodeium: Unexpected response: ]10;rgb:c0caf5\]11;rgb:1a1b26\]12;7\{"api_key":"api-key-was-here","name":"my name"}

n-crespo avatar Aug 15 '24 19:08 n-crespo

Got it. I will look on weekends if I can fix it.

monkoose avatar Aug 15 '24 19:08 monkoose

@n-crespo I have tested on windows 11 and Ubuntu wsl, and it worked for me perfectly. As you have mentioned it required wslu but other than that I don't have any issues.

monkoose avatar Aug 15 '24 20:08 monkoose

I'm closing this. @s1nistr4 if you still using necodeium and have the same issue it would require more information and logs from you side.

monkoose avatar Sep 08 '24 12:09 monkoose

After installing a clean version of ubuntu WSL and cloning my config, the auth and completion all works perfectly. Not sure what was wrong. Sorry for the late follow up.

n-crespo avatar Sep 16 '24 08:09 n-crespo

It's all good. Glad it worked for you. Thanks for confirmation.

monkoose avatar Sep 16 '24 08:09 monkoose

I'm also a linux user and entering the token from the website gives me the invalid token-message, too. The workaround works perfectly for me. I suggest to add it to a FAQ section in the README maybe?

I found (somewhat) of a solution for this: manually enter the API key into ~/.codeium/config.json. The file should look like this:

{ "api_key": "your-api-key"}

Not pretty, but it works.

bschnitz avatar Sep 25 '24 11:09 bschnitz

How do you paste it? Are you sure that you paste the right thing? I would not add some hack to any FAQ, because it can break at any time with internal change.

monkoose avatar Sep 25 '24 12:09 monkoose

I'm copying it the exact way Arpit-Moga copies it (https://github.com/monkoose/neocodeium/issues/12#issuecomment-2291044389). So the browser opens correctly, I select the key by double clicking on it, after which I hit Ctrl-C. I also confirmed, that I copy it correctly by inserting it in another vim window. When iserting into the prompt, it will show me some lines of * (asterix) characters, same as in Arpit-Mogas screenshot.

My pasting method may be somewhat special: I mapped a keycombination in the kitty terminal to paste. But that normally works quite fine. Also I had no problems inserting the key when using the codeium.nvim plugin.

Is there a function I could invoke from neovim to check if the key is correctly generated? Then I could compare it to the key generated by the codeium.nvim plugin.

Edit: I'm using Manjaro Linux and I don't think that I'm using WSL, although I don't know exactly, what that is (there is no wslview command in my executable path).

bschnitz avatar Sep 25 '24 13:09 bschnitz

The only thing that I think of is that there are some json decoding and escaping special characters are done, before verification, maybe it breaks something in the process. Could I ask you to test if your token contains some special characters? Run :NeoCodeium auth, copy the token, paste it into a buffer, and on that line execute

:s/[[:alnum:]._-]*//g

If any characters left can you paste them here?

monkoose avatar Sep 25 '24 16:09 monkoose

There is nothing leftover, so there are no special characters inside the token.

bschnitz avatar Sep 25 '24 17:09 bschnitz

Ok, it was my fault. I double clicked on the key to select it. Unfortunatly, since only part of the key was shown in the browser, I didn't notice, that I didn't copy the complete key. Clicking three times on it worked. Thank You for your effort and this great plugin!

bschnitz avatar Sep 25 '24 17:09 bschnitz