I have successfully implemented Google Calendar's quickstart guide for Node.js: https://developers.google.com/calendar/api/quickstart/nodejs
Its all working as expected for a single user at a time, however if a second user accesses the page while the first user is still using it they get the error Error: listen EADDRINUSE: address already in use :::3000
I can see this happens because client = await authenticate(...) starts a server on port 3000, so when the second user enters the page this code attempts to start another server on the same port and therefore errors.
So what should I be doing here? This seems flawed for a real world system. Plus the only Authorised Redirect URI seems to be http://localhost:3000/oauth2callback due to whatever the google-cloud/local-auth package is doing.
I need a solution that works for our production environment with many concurrent users.