Anyone setup OAuth in Electron app?

I’m trying to figure out how to allow a user to authenticate with Google OAuth and return the access token/refresh token to the Electron app.

I’ve already setup a deep-link (brightyard://) in capacitor.config.json for the return to the Electron app, but I need to figure out how to wire it all up and then be able to act on the returned URL with tokens to the electron app.

  "electron": {
    "deepLinkingEnabled": true,
    "deepLinkingCustomProtocol": "brightyard"
  }

The high-level steps that I believe are necessary are:

  1. Add a button in Electron app that can launch a URL in the browser of the client machine. It looks like this will require adding a renederer.js file, modifying the preload.js and main.js files, and adding the renderer.js to my the HTML file where the button will exist.
  2. The URL is to my API server, which will use the Server Connect oauth API that I set up to connect to Google so the user can authenticate
  3. It will return to the API server, which will then redirect to the deep-link with params to open in the Electron app

Has anyone set this up before?

An example is available to launch in Electron Fiddle that shows the code and example of how it works.

I am getting exact this problem, did you get any solution to get this running?

Hi @sleeviin, I did get it setup. What are you having challenges with?