How to Integrate Google OAuth for Calendar Access in Firefox Extension? (Previously Successful in Chrome)

Hi everyone,

I’m currently developing a Firefox extension that needs to access the user’s Google Calendar after authentication through Google OAuth. I successfully built a similar extension for Chrome, where everything works perfectly. In Chrome, after setting up the OAuth Client ID in the Google Developer Console, Google handles the redirect to the extension seamlessly.

However, I’m encountering challenges with the Firefox extension:

  1. Context:
  • I have a Chrome extension where users can log in through Google OAuth to access their Google Calendar.
  • In Chrome, the redirect URI is handled internally by Google, and everything works fine.
  1. The Issue in Firefox:
  • I’m trying to replicate the same functionality in a Firefox extension, but I’m unsure how to correctly configure the OAuth Client ID in the Google Developer Console.
  • Specifically, I’m facing difficulties with the redirect_uri setup. In Chrome, the redirect is straightforward, but Firefox seems to handle it differently.
  • I’ve attached a screenshot of my current OAuth Client ID setup (see below).
  1. Questions:
  • How do I correctly set up the redirect_uri for a Firefox extension in the Google Developer Console?
  • Is there a specific format or domain I need to use for the redirect_uri in Firefox?
  • How can I ensure that the login process via Google OAuth works smoothly, similar to how it does in Chrome, so users can access their calendars?
  1. Current Setup:
  • OAuth Client ID: Configured in the Google Developer Console.
  • Redirect URI: Currently not working as expected in Firefox. I tried using the moz-extension:// URL generated by browser.identity.getRedirectURL() but encountered issues with Google accepting this domain.

Any guidance or examples of how to correctly configure Google OAuth for a Firefox extension would be greatly appreciated. My goal is to allow users to securely log in with Google and grant my extension access to their calendar.

Thank you in advance for your help!