randomBrainstormer / MMM-GoogleCalendar

Google Calendar for MagicMirror²
MIT License
64 stars 42 forks source link

Headless pi setup #63

Open vih-rar opened 3 months ago

vih-rar commented 3 months ago

Hi, I've had no issues running this module on a windows, but I'm trying to move this setup to a headless pi zero w, without a desktop interface. How can I go about doing the authorization in this case? I get the following message right now image

Thank you

randomBrainstormer commented 3 months ago

Hi @vih-rar ,

Thank you for reaching out and for sharing the details of the issue you're facing. From the screenshot and the information you provided, it seems like the plugin is unable to locate token.json, which indicates that the authentication step hasn't been completed successfully. Typically, the process involves automatically launching a small browser window for user authentication. However, given that you're working on a headless Pi Zero W setup and presumably accessing it via SSH, this direct method of authorization won't work in this scenario, unfortunately.

Since the plugin doesn't support headless authorization out of the box, I would recommend a couple of workarounds:

  1. Using VNC: Establish a VNC connection to your Raspberry Pi. This will allow you to interact with a virtual desktop environment, making it possible to complete the browser-based authentication process as if you were working with a monitor attached directly to the Pi.

  2. Direct Connection: Alternatively, if setting up a VNC connection isn't feasible for you, connecting a keyboard and mouse directly to your Raspberry Pi could be another way to proceed. This, of course, requires that you temporarily connect your Pi to a display for the authentication process.

I understand these approaches might not be as straightforward as SSH, but due to the plugin's current limitations regarding headless environments, these are viable methods to complete the necessary authentication.

I hope this helps and you're able to get your setup running smoothly on the Pi Zero W. If you have any more questions or run into further issues, do not hesitate to ask.

vih-rar commented 3 months ago

Thank you for the tips! I had a raspbian lite installed so it could handle a server and browser at the same time, so I would still face the problem with VNC. But I'm switching to a zero 2 W now, and hopefully that should solve all the current problems.

vih-rar commented 2 months ago

Hi again The zero 2 W did not solve my problem, due to the same RAM and low swap space. Any desktop environment on it would not let me open a browser, and I only need the browser interface to log into the calendar API. Is there any way I can modify your files to output the link, and use the link on my host laptop rather than open it on the pi itself?

randomBrainstormer commented 2 months ago

Hi @vih-rar ,

I understand the challenges you're facing regarding limited resources and the need to access the browser interface for authentication. Unfortunately, the current implementation of the authorization process for this plugin relies on a direct interaction with a web browser on the Raspberry Pi itself. As you mentioned, this can be problematic in headless setups or devices with resource constraints.

Regarding your suggestion about modifying the files to output a link for authentication on a separate device, this approach isn't supported by the current design of the plugin. The authentication process is inherently tied to the environment where the plugin is executed, requiring direct user interaction for security reasons.

I would recommend exploring alternative methods or tools that are specifically designed to handle authentication in headless or constrained environments. Researching Google's recommended approaches for limited tv and limited input device applications might provide insights into potential workarounds or solutions that align better with your setup. This plugin implements similar kind of authentication, perhaps you can find inspiration from there.

I appreciate your understanding of the plugin's limitations and encourage you to explore other approaches that align better with your setup.

If you have any further questions or if there's anything else I can assist you with, please feel free to reach out.