Skip to content

Switch 'log in with snap' feature from Discourse SSO to Snap!Cloud provider#411

Open
cycomachead wants to merge 1 commit intomainfrom
cycomachead/1-switch-snap-login-provider/1
Open

Switch 'log in with snap' feature from Discourse SSO to Snap!Cloud provider#411
cycomachead wants to merge 1 commit intomainfrom
cycomachead/1-switch-snap-login-provider/1

Conversation

@cycomachead
Copy link
Copy Markdown
Member

Pivotal Tracker Link

What this PR does:

This pull request implements switching the "Log in with Snap" feature from using the Snap Forum (Discourse) as the SSO provider to using Snap!Cloud directly.

Since Snap!Cloud already implements the Discourse SSO provider protocol at /api/v1/discourse-sso, no gem changes are needed — the existing omniauth-discourse gem works as-is, just pointed at a new URL.

Key Changes

  • config/initializers/devise.rb — Updates the SSO URL to https://snap.berkeley.edu/api/v1/discourse-sso (configurable via OSEM_SNAP_SSO_URL). Secret now reads from OSEM_SNAP_SSO_SECRET with fallback to OSEM_DISCOURSE_SECRET for backward compatibility.
  • app/helpers/users_helper.rb — Fixes provider detection for Discourse SSO, which only requires a secret (not a key+secret pair like OAuth providers). Now correctly checks for OSEM_SNAP_SSO_SECRET or the fallback.
  • Removes the outdated UI warning about needing to "log in twice" when using the Snap Forum — no longer applicable with the new provider.

How should this PR be tested?

  • Configure OSEM_SNAP_SSO_SECRET to match the DISCOURSE_SSO_SECRET set in the Snap!Cloud instance and verify the login flow completes successfully end-to-end.
  • Verify the "Log in with Snap" button appears when OSEM_SNAP_SSO_SECRET is set and does not appear when it is unset.
  • Existing specs cover the provider detection logic via spec/support/omniauth_macros.rb.

Are there any complications to deploying this?

  • The OSEM_SNAP_SSO_SECRET must match the DISCOURSE_SSO_SECRET configured on the Snap!Cloud side. Existing deployments using OSEM_DISCOURSE_SECRET will continue to work without changes due to the fallback — no immediate action required on deploy.

Checklist:

  • Has this been deployed to a staging environment or reviewed by a customer?
  • Tag someone for code review (either a coach / team member)
  • I have renamed the branch to match PivotTracker's suggested one (necessary for BlueJay)

Superconductor Ticket Implementation | Guided Review

Replaces the Discourse forum SSO provider with Snap!Cloud's SSO endpoint.
Since Snap!Cloud implements the same Discourse SSO protocol, this change
updates the configuration URLs and environment variables while
maintaining backward compatibility for the SSO secret.

- Update SSO URL to point to snap.berkeley.edu API
- Introduce OSEM_SNAP_SSO_SECRET and OSEM_SNAP_SSO_URL env vars
- Fix provider detection logic to only require a secret for Discourse
- Remove outdated "log in twice" UI warning
- Add Discourse mock authentication for development and testing

Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant