Skip to content

feat: Add Auth0 authentication integration to site template#369

Closed
cherriechang wants to merge 2 commits intofixAWSfrom
add-authentication-system
Closed

feat: Add Auth0 authentication integration to site template#369
cherriechang wants to merge 2 commits intofixAWSfrom
add-authentication-system

Conversation

@cherriechang
Copy link
Copy Markdown
Contributor

Summary

Adds Auth0 authentication as an optional feature for Pushkin sites. When enabled in pushkin.yaml, sites get:

  • Login/Logout buttons with Auth0 OAuth2 flow
  • User profile page showing Auth0 user info
  • Auth0 user IDs stored in Redux and sent to backend APIs
  • Seamless integration with existing session-based auth (fallback when Auth0 is disabled)

Changes

  • Auth0 Components: Login, Logout, Profile pages using @auth0/auth0-react SDK
  • Redux Integration: AuthSync component syncs Auth0 state to Redux store
  • Dual Auth Support: Sites can use Auth0 or session-based auth (controlled by pushkin.yaml)
  • User ID Propagation: Auth0 user IDs (e.g., google-oauth2|123...) flow through React → Redux → Experiments → API
  • Template Updates: All Auth0 files in templates/sites/basic/src/pushkin/front-end/

Configuration

In pushkin.yaml:

addons:
  useAuth: true
  authDomain: your-auth0-domain.us.auth0.com
  authClientID: your-auth0-client-id

Testing

  • ✅ Auth0 login/logout flow working
  • ✅ User ID propagates from Auth0 → Redux → API
  • ✅ API receives Auth0 user IDs successfully
  • ⏳ Database persistence pending (blocked by unrelated RabbitMQ issue in test site)
  • ⏳ Fresh site creation test pending
  • ⏳ AWS deployment test pending

Next Steps

  1. Test on fresh Pushkin site to verify full database flow
  2. Test on gww-site deployment
  3. Test on AWS production deployment
  4. Add documentation for Auth0 setup process

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

cherriechang and others added 2 commits November 20, 2025 23:15
This commit adds comprehensive Auth0 authentication support to the basic site template, enabling OAuth2/OIDC authentication for Pushkin users. The implementation is backward-compatible and only activates when useAuth is enabled in pushkin.yaml.

Key Changes:
- Added Auth0 authentication components (Login, Logout, Profile)
- Added AuthSync component to synchronize Auth0 state with Redux
- Enhanced Redux infrastructure to handle both Auth0 and session-based auth
- Updated Header component with conditional auth buttons and 'My account' link
- Added conditional Auth0Provider wrapper in index.js
- Created config.js to expose authDomain and authClientID from pushkin.yaml
- Added @auth0/auth0-react dependency to package.json
- Added /profile route to App.js

Features:
- Dual authentication modes: Auth0 (when configured) and session-based (fallback)
- Conditional rendering based on useAuth config setting
- Seamless integration with existing Redux state management
- User profile management via Auth0 dashboard
- Automatic token refresh and localStorage caching

Configuration:
Sites can enable Auth0 by setting in pushkin.yaml:
  addons:
    useAuth: true
    authDomain: your-domain.auth0.com
    authClientID: your-client-id

All changes are backward-compatible. Sites without Auth0 configuration will continue using session-based authentication.
- Header's useEffect now skips dispatching getUser() when Auth0 is enabled
- Auth0 users are managed by AuthSync component via SET_AUTH0_USER action
- This prevents session-based user IDs from replacing Auth0 user IDs in Redux

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 22, 2025

⚠️ No Changeset found

Latest commit: 407a4ec

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@cherriechang cherriechang deleted the add-authentication-system branch November 24, 2025 23:31
@cherriechang
Copy link
Copy Markdown
Contributor Author

closed in favor of #375 after renaming branch

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