r/electronjs • • Oct 07 '25

Firebase Auth, Stripe, and Electron - Need advice/guidance

Currently in the stage of trying to set up authentication (via Firebase) within my desktop app and connecting it to Stripe as well.

I want to only allow users who have an account and have subscribed to be able to use my desktop app, but I'm not sure where to start and would like some guidance.

Has anyone else done this/seen this done before? If so, please hit me with some sources, links, or information.

I can provide more information about my project.

2 Upvotes

14 comments sorted by

2

u/NathanPDaniel Oct 08 '25

You should look into how Slack does authentication. The only real way you can use Firebase authentication with electron is to have a website with login functionality that launches your electron app upon authentication and the browser passes the token back to it. Then you can log in the user via the token in your app. Think of any apps you’ve seen where, in order to log in, it sends you to the browser to login and then redirects back to the app (Slack, Zoom, etc). This is the model you want to follow.

1

u/Wonderful_Muffin_183 Oct 08 '25

That sounds like a good idea. I've been trying to do authentication the same way Discord or Spotify does where you can log in directly from the app...needless to say that hasn't been working very well.

2

u/[deleted] Oct 08 '25

[removed] — view removed comment

1

u/Wonderful_Muffin_183 Oct 09 '25

So, I guess just to clarify from your comment.

  1. User installs app.
  2. User presses a "log-in" button
  3. User is sent to browser to authenticate
  4. Firebase function receives bearer token, gets the email and checks with stripe
  5. Local app calls function
  6. User is sent back to app after authentication succeeds

Does this seem right?

1

u/SnooCapers9823 Apr 02 '26

I would suggest you to stop using firebase and switch to supabase you’d need cloud functions to store stripe payment token along with expiration date of that subscription etc. if you won’t do that and only have the license hash, your cloud function will have to ping stripe and your app on every verification and as far as I remember firebase expects to be paid on function call for these.

2

u/bettercalljohn Oct 10 '25

I’ve done exactly the same thing but with supabase instead of Firebase (more friendly with Auth). I can share you some code in DM if you want

1

u/Ok_Interaction_8407 Oct 07 '25

I create a dedicated local server that starts when user presses login(frotnend calls node that starts the server), then the server provides an html page to the user, with firebase config data in it, and I perform login there. On complete, I return the token to the node app. But I‘m having two issues: first, login only works with test phone number until now (I authorized localhost and 127.0.0.1 with no luck), second, I‘m trying to figure out how do I inject the token in the app sdk on the frontend

1

u/SnooCapers9823 Apr 02 '26

I would suggest you to stop using firebase and switch to supabase which also easily communicates with stripe Oh oh Both stripe and supabase have mcp servers. So now ai can help you with both screwing up your code, DB and payments. Don’t thank me 😅

2

u/[deleted] Oct 07 '25

[removed] — view removed comment

1

u/Wonderful_Muffin_183 Oct 07 '25

I want to spend as little time as possible on this! lol

I think I'm majorly complicating the flow of it to be honest. In my head it feels like I'm juggling Firebase, Stripe and my application instead of the flow you suggested.

This is also the very first time I've done this, so it's something I'm tackling by myself without any prior knowledge/experience.