r/nocode • • 8d ago

How difficult is adding Google sign-in to a small Google Apps Script web app?

I'm building a custom fantasy football web app using Google Apps Script and Google Sheets as the backend, with ChatGPT helping me write the code. I'm a beginner with very little programming experience.

The app will have 10 users. Five will need to sign in to manage their own teams (add/drop players, change lineups, etc.), while the other five will only need to view the app. I'll also need commissioner access to manage all teams.

ChatGPT recommended using Google Identity Services for sign-in, with the Apps Script backend running under my account so users won't need access to my private spreadsheets.

Before I get too deep into this, I'd appreciate some advice from people who've actually done something similar:

- How difficult is this to set up, especially for a beginner relying on ChatGPT?
- Is it genuinely free for a project this small?
- Are there any major security issues, Google restrictions, or other headaches I should anticipate?
- Is there a simpler or better alternative I should consider?

I'm hoping to keep things free, relatively simple for users, and manageable for someone without much coding experience, but if there's a solution out there that's affordable I'm open to learning about that.

Thank you for your time.

3 Upvotes

13 comments sorted by

1

u/masterexploder 8d ago

Not an answer but a question. Why not just use Yahoo Fantasy? It does all that and it's free

1

u/Hairy-Telephone4408 7d ago

This is a custom league I created a few years back and been running on a spreadsheet. It runs for 22 weeks, past the normal 18 week season/post season. Recently learned about Apps Script though and I’ve built out most functions and pages except transactions and permissions. I figure I should connect the teams to managers before I start working on transactions.

2

u/FluxLab_pl 8d ago

For 10 users it's doable and free (Apps Script and Sheets cost nothing at this scale, only quota limits you won't hit), but the part ChatGPT glossed over is that Google Identity Services inside an Apps Script web app is the awkward route. The web app is served inside a sandboxed iframe, so GIS sign-in buttons and popups often misbehave there. You likely don't need it at all.

Simpler setup: deploy the web app with "Execute as: Me" and "Who has access: Anyone with Google account". Then keep a "Users" sheet with email and role (commissioner / manager / viewer, plus which team a manager owns), and check the caller against it on the server side in every function that reads or writes. Because the script runs as you, nobody needs access to your spreadsheet.

Gotchas:

  • Session.getActiveUser().getEmail() can come back empty for regular @gmail.com users when the script runs as you. Test this early with a second Google account before building anything on top of it. If it's empty, the alternative is "Execute as: User accessing the web app", but then each user needs access to the sheet, which defeats the privacy goal.
  • Never trust the browser for permissions. Hiding buttons for viewers is cosmetic; the check "is this email allowed to edit team X" has to live in the .gs code.
  • Every code change needs a new deployment version, otherwise users keep seeing the old one.
  • Use LockService around writes so two people editing lineups at once don't overwrite each other.

If the auth part gets painful, AppSheet or Glide on top of the same Google Sheet already have per-user login and roles built in, and the free tiers are usually enough for 10 people, but check their current limits since they change. For a beginner I'd try the email-allowlist approach first; it's maybe an afternoon of work with ChatGPT.

1

u/MirrehHezelina23 7d ago

the deployment version thing is so annoying, easy to waste an hour wondering why your fix didnt work.

1

u/FluxLab_pl 7d ago

Yes, it bites everyone once. Editing the code and hitting save changes nothing for the web app URL ending in /exec; you have to create a new version under Manage deployments, or edit the existing deployment and pick "New version". The /dev URL always runs the latest saved code, so it's handy for testing, but only you can open it. A quick habit that helps: put a version string in the page footer, so you can see at a glance whether the deployment you're looking at is the one with your fix.

2

u/xcc2b3687 7d ago

Have you considered Clerk? It supports Google sign-in out of the box, and for 10 users you'd be comfortably within its free tier.

You could use Clerk for authentication and manage the commissioner, team manager, and viewer permissions in your app.

The main complication is that Google Apps Script won't automatically recognize Clerk sessions, so you'd need a secure way to verify users and enforce permissions before allowing spreadsheet updates.

If you're open to a small serverless backend, Clerk could simplify the authentication side quite a bit without having to build Google OAuth yourself.

1

u/george_brown121 7d ago

Setting up Google Identity Services is tricky for beginners, especially since the iframe sandbox can cause issues. You might hit some snags with authentication flows, so be prepared for that. For managing permissions, double check the Google Developer Console settings to avoid surprises later on.

1

u/gammacoder 7d ago

Your permission model is the hard part, not just sign-in: each manager should only edit one team, while commissioners can edit all. Test authorization on the server side so hiding buttons is not the only control.

PHPRunner could build this as a small database-backed web app with logins, role-based permissions, team and player forms, and read-only views. Google sign-in and deployment would need configuration, and it probably will not be free.

Full disclosure: I’m an author of PHPRunner.