itchyny / calendar.vim

A calendar application for Vim
MIT License
1.95k stars 71 forks source link

:Calendar restarts authorization after I paste Googles code when using neovim #214

Closed JJJHolscher closed 1 year ago

JJJHolscher commented 1 year ago

The final step in https://github.com/itchyny/calendar.vim#important-notice re-opens the browser and again requests I put in the code that I get from there. My API key works, I tested it with gcal-cli afterwards.

The prompt for the request for pasting the code after pasting the code looks like:

Access https://accounts.google.com/o/oauth2/auth?client_id=$CLIENT_ID&redirect_uri=$LOCALHOST_UL&response_type=code&scope=$SCOPE and paste the code
CODE: ${$PASTED_CODE}Access https://accounts.google.com/o/oauth2/auth?client_id=$CLIENT_ID&redirect_uri=$LOCALHOST_UL&response_type=code&scope=$SCOPE and paste the code
CODE: 

Here I omitted some $VARIABLES After re-entering the new code the whole process just repeats again. If I open a new neovim instance and call :Calendar, I again go through this process.

itchyny commented 1 year ago

Start the calendar with -debug option and investigate the responses in ~/.vim/cache/calendar.vim/download/.

JJJHolscher commented 1 year ago

~/.cache/calendar.vim/download is empty after calling :Calendar -debug and after setting let g:calendar_debug = 1. ~/.vim did not exist and after making ~/.vim/cache/calendar.vim/download it too stayed empty. ~/.cache/calendar.vim/google contains a valid-looking access token and a refresh token.

itchyny commented 1 year ago

Sorry the default download directory is ~/.cache/calendar.vim/download. Any case, could you debug with echom content here?

JJJHolscher commented 1 year ago

thank you for your assistance I get

{'refresh_token': '1//09...2F8', 'scope': 'https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/tasks', 'access_tokes': 'ya2...163', 'expires_in': 3599, 'token_type': 'Bearer'}

This token seems to be identical to what is stored in ~/.cache/calendar.vim/google/access_token ls -l ~/.cache/calendar.vim/google returns

-rw------- 1 user user 490 Feb  2 12:36 access_token
-rw------- 1 user user 125 Feb  2 12:36 refresh_token
JJJHolscher commented 1 year ago

I remade my API keys to be sure. Both gcalcli and the python library gcsa can work with it. I tested it with a different account and the different account again works with gcalcli and gcsa but gets calendar.vim to give the same behavior as before. I uninstalled all my neovim plugins to no avail (I use packer). I also uninstalled packer and just cloned calendar.vim into ~/.local/share/nvim/site/pack/vendor/start while keeping a very vanilla init.vim Removing let g:calendar_google_calendar = 1 does get me a(n empty) calendar upon calling :Calendar.

What did work was using vim instead of neovim. My vim was vanilla aside from cloning this repo into ~/.vim/pack/vendor/start, sourcing the credentials and setting let g:calendar_google_calendar = 1. I did not need to log in even (It probably reuses the login from nvim). I would prefer to use neovim however.

itchyny commented 1 year ago

Thank you, I didn't check my plugin against neovim. Now it should work properly.