Skip to content

feat: Add React Native Web Support for Auth0 with Class-Based Implementation#1221

Closed
subhankarmaiti wants to merge 4 commits into
SDK-6110-initial-setupfrom
SDK-6110-core-functionality
Closed

feat: Add React Native Web Support for Auth0 with Class-Based Implementation#1221
subhankarmaiti wants to merge 4 commits into
SDK-6110-initial-setupfrom
SDK-6110-core-functionality

Conversation

@subhankarmaiti
Copy link
Copy Markdown
Contributor

🎯 Overview

This PR adds full React Native Web (RN Web) support to the react-native-auth0 library by implementing web-specific versions of all core Auth0 classes using the @auth0/auth0-spa-js library.

🚀 What's New

📦 New Web Implementation Files

  • src/auth0/index.web.ts - Main Auth0 client with automatic redirect handling
  • src/auth/index.web.ts - Auth class with secure SPA-focused methods
  • src/webauth/index.web.ts - WebAuth class supporting redirect-based flows
  • src/credentials-manager/index.web.ts - Credentials manager using auth0-spa-js token management
  • src/management/users.web.ts - Management API client for user operations
  • src/specs/NativeA0Auth0.web.ts - Web-compatible native module spec

🔧 Key Features

  • 🔐 Secure Authentication Flow: Redirect-based login using Auth0 Universal Login
  • 🏗️ Class-Based Architecture: Maintains API compatibility with existing React Native implementation
  • ⚡ Automatic Token Management: Leverages auth0-spa-js for secure token storage and refresh
  • 🛡️ Security-First Approach: Non-recommended methods throw helpful errors guiding developers to secure flows
  • 🔄 Seamless Integration: Drop-in replacement that works with existing Auth0 configurations

🛠️ Implementation Highlights

  • Uses @auth0/auth0-spa-js v2.2.0 as the underlying web client
  • Automatic redirect callback handling on app initialization
  • Memory-based token storage for enhanced security
  • Compatible method signatures with mobile implementations
  • Comprehensive error handling and developer guidance

📋 Updated Dependencies

  • Added @auth0/auth0-spa-js: ^2.2.0 as peer dependency to support web authentication flows

🎯 Benefits

  • Cross-Platform Consistency: Same Auth0 API across React Native mobile and web
  • Enhanced Developer Experience: No need to learn different APIs for different platforms
  • Production Ready: Built with security best practices for SPA applications
  • Future Proof: Extensible architecture supporting additional Auth0 features

🧪 Testing

  • Compatible with existing React Native Auth0 configurations

@subhankarmaiti subhankarmaiti requested a review from a team as a code owner June 30, 2025 04:27
@subhankarmaiti
Copy link
Copy Markdown
Contributor Author

closing this as we have created a single PR for refactoring

@subhankarmaiti subhankarmaiti deleted the SDK-6110-core-functionality branch July 14, 2025 03:57
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