monkoose/neocodeium

Shipping broken, api key doesn't work

Opened this issue · 22 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

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.

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.

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.

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 which OS do you use?

@Arpit-Moga which OS do you use?

Windows 11

image

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 No , I do have WSL install but I am using Neovim on windows

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

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

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"}

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

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

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.

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.

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

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.

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.

I'm copying it the exact way Arpit-Moga copies it (#12 (comment)). 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).

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?

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

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!