soumya92/barista

Gmail, Calendar and Github notifications not working

hpio opened this issue · 10 comments

hpio commented

Hi,
first of all let me say how much I like your project. I've recently came across it and while trying it out I found an issue I'm not able to solve.

As per your quickstart I have configured setup-oauth step for Gmail, Calendar and Github and restarted i3 but bar only displays Error|Error|Error.

Right clicking on errors shows me:

  • Gmail: invalid character ``` looking for beginning of value
  • Github: invalid character \u0082 looking for beginning of value
  • Calendar: error message to long to display on screen.

I'm using sample bar pulled from the url in quickstart. As I'm unable to find any logs for the bar I can't provide more information at this time

Hmm, that sounds like the keyring is not working.

Barista uses the keyring to synchronise encryption keys between the setup-oauth and the running bar. If the keyring is not working correctly, each process will generate a different random encryption key, causing garbage values during decryption.

Can you check that the secret is correctly stored? Run secret-tool lookup service barista username oauth; if there is no output, then the keyring might not be configured properly. See the docs for go-keyring for how to set it up.

hpio commented

Your comment pointed me in the right direction, I did not have gnome-keyring installed. Once done, re-configured setup-oauth and everything's working.

Many thanks for prompt reply!

No problem. Glad it's working for you.

I'm facing the same problem when trying to use my own OAuth credentials rather than the default ones. I don't think it's a keyring issue - the sample bar works fine, while my custom bar with my own OAuth credentials does not. The only difference in code is that I've removed Gmail and Github notifications.

It would be nice if these cryptic Error messages were more debuggable.

If the bar shows you Error, you can right click on the segment to get the full message displayed using i3-nagbar.

image

This is tricky to debug. Any way I could log it?

Ugh, I should clean up that error message. There's no reason the print the whole URL...

Since you're building your own bar, you can probably use the logging package (https://barista.run/logging) and add some logs either to the calendar module here (

evts, err := fetch(srv, conf)
) or to the sink here (
s(ErrorSegment(e))
).

In fact, if you want to send me a PR that logs errors by default when clicked (

b.errorHandler(bar.ErrorEvent{Error: err, Event: e})
), I would happily merge it in. Logging is disabled by default, so there should be no cost to doing so, while simplifying debugging when building with -tags debuglog

I've filed #74 to track.

I'm busy with work currently, but once I have some time off I'll have a look at it.

I managed to log the error to a file.

$ cat /tmp/barista
Get https://www.googleapis.com/calendar/v3/calendars/primary/events?alt=json&fields=items%28end%2Clocation%2Cstart%2Cstatus%2Csummary%2Cattendees%2Creminders%29%2CdefaultReminders&maxAttendees=1&orderBy=startTime&prettyPrint=false&singleEvents=true&timeMax=2019-05-22T08%3A22%3A40%2B08%3A00&timeMin=2019-05-21T14%3A22%3A40%2B08%3A00: open /home/dani/.config/barista/oauth/accounts.google.com_h4t7vKdZ8bdNUC84tgkAVX4Vc48AEaO3PYBoHQ.json: no such file or directory

It's complaining that a JSON file does not exist. When running my_barista setup-oauth it creates

~/.config/barista/oauth/accounts.google.com_hJH2bG9JCbl58ZDknZDsVqVtwZZ9fzDctHu0pQ.json

which does not match the file barista is looking for at runtime.

When using the default barista sample with your OAuth settings it works fine. Any ideas?

Hmm, that's unusual. The hash is generated from the Client ID and scopes, so if they differ, somehow the setup process is signing you in with either a different Client ID or a different set of scopes (or both).

Since that's not a keychain issue, let's discuss further on #75.