itchyny / calendar.vim

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

Error authenticating google on Windows #226

Open adam-coates opened 9 months ago

adam-coates commented 9 months ago

Hi I have ran into a bit of a problem with windows nvim. I have managed to get the calender authentication to work for both MAC and linux (and WSL linux ubuntu). However, I notice that on Windows Python 3 is not often called with Python3 but simply just Python . I notice that in the client.vim https://github.com/itchyny/calendar.vim/blob/66e6d0955efb6beb68912dce3ff484e8805d975c/autoload/calendar/google/client.vim#L49 it checks Python3 is exe. So to solve this I created a symbolic link so that Python3 is now onpath and exe. This firstly resolves the error I initially get "Python 3 is required".

I have checked curl and wget are installed as well as the pyvim and neovim python packages however I get the error.

Error output:

Error detected while processing function calendar#new[19]..31[3]..33[2]..38[4]..87[27]..118[1]..159[1]..310[8]..309[21]..186[11]..184[1]..195[16]..calendar#google#calendar#getEvents[2]..calendar#google#calendar#getCalendarList[5]..calendar#google#client#get_async[1]..<SNR>88_request_async[1]..calendar#google#client#access_token[3]..calendar#google#client#initialize_access_token: line 18: E474: Attempt to decode a blank string E474: Failed to parse Error detected while processing function calendar#new[19]..31[3]..33[2]..38[4]..87[27]..118[1]..159[1]..310[8]..309[21]..186: line 11: E715: Dictionary required E1098: String, List or Blob required

I find that if I echom string(response.content) before line 66 https://github.com/itchyny/calendar.vim/blob/66e6d0955efb6beb68912dce3ff484e8805d975c/autoload/calendar/google/client.vim#L66C31-L66C47 that the string is entirely empty, thus the content var is also empty.

Any idea as to why I can't seem to get a return from would be appreciated, thanks in advance.

I have tried also multiple installs of Python, browsers etc. but to no avail.

itchyny commented 9 months ago

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

adam-coates commented 9 months ago

Hi thanks for the response.

I started the plugin with :Cal -debug and a new directory is created ~/.cache/calendar.vim/download/

But the directory appears empty.

Are there some other lines I could echo out?

itchyny commented 9 months ago

Sorry, I forgot the synchronous process like initialization does not leave logs. Please confirm the command and results around here. https://github.com/itchyny/calendar.vim/blob/66e6d0955efb6beb68912dce3ff484e8805d975c/autoload/calendar/webapi.vim#L100

adam-coates commented 9 months ago

Hi again, thanks again for responding. Okay this makes sense why there isn't any output from the -debug.

When I echo command before line 100 I get (if webapi uses Curl):

curl --http1.1 --suppress-connect-headers -s -k -i -N -X POST -H 'Content-Length: 289' --data-binary @'C:\Users\User\AppData\Local\Temp\nvim.0\F9FEEy\0' 'https://accounts.google.com/o/oauth2/token'

When I echo command before line 100 I get (if I remove option to curl I get):

wget -O- --server-response -q --header='X-HTTP-Method-Override: POST' --header='Content-Length: 289' --post-file='C:\Users\User\AppData\Local\Temp\nvim.0\SUJsSl\0' 'https://accounts.google.com/o/oauth2/token'

Echoing response I get: {'status': '0', 'header': '', 'message': '', 'content': ''}

And the path to C:\Users\User\AppData\Local\Temp\nvim.0\SUJsSl\0 is empty.

For on my Linux machine I echo command and get:

curl --http1.1 --suppress-connect-headers -s -k -i -N -X POST -H "Content-Length: 289" --dat ', 'content': ''OKing: chunkedng00,h3-29=":443"; ma=2592000tore, max-age=0, must-revalidate

And the response is then all the fields correct for: access_token, expires_in, refresh_token, scope, token_type.

On my linux machine it works no problem. This is also true for linux running in the windows environment using WSL.

I hope this can help narrow down the issue a bit.

I have now also updated curl since I noticed some differences in the versions between my linux, windows and WSL linux.

Thanks again for the help, I know that you're interested in other projects now but I am greatful for the response.