A minimal React application demonstrating the core functionality of the @nylas/connect package.
- 🚀 Simple "Connect" button to initiate authentication
- 🔐 Hosted authentication popup flow
- ✅ Beautiful success page displaying user information
- ❌ Clear error handling and messaging
- 🎨 Modern UI with Tailwind CSS
- 📦 Zero build dependencies (uses CDN for all libraries)
-
Configure Nylas Client ID:
- Open
index.htmlandcallback.html - Replace
YOUR_NYLAS_CLIENT_IDwith your actual Nylas Client ID - You can get your Client ID from the Nylas Dashboard
- Open
-
Configure Redirect URI:
- In the Nylas Dashboard, add your application's callback URL to the allowed redirect URIs
- For local development, add:
http://localhost:8000/callback.html(or whatever port you're using) - Important: The redirect URI must end with
/callback.html
Since this is a simple HTML file with no build process, you can run it using any static file server:
# Python 3
python3 -m http.server 8000npx http-server -p 8000php -S localhost:8000Then open your browser and navigate to:
http://localhost:8000
- Connect Button: Click the large "Connect" button to start the authentication flow
- Popup Authentication: A popup window opens with the Nylas hosted authentication page
- Success: After successful authentication, the app displays:
- User's first name
- User's last name
- Grant ID
- Error Handling: If authentication fails, a clear error message is displayed
-
index.html- Main application page containing:- React components using hooks
- Tailwind CSS for styling
- Nylas Connect integration
- Error handling logic
- Message listener for popup callbacks
-
callback.html- OAuth callback handler:- Processes the OAuth redirect
- Communicates back to the main window
- Handles authentication success/failure
You can easily customize the appearance by modifying the Tailwind CSS classes in the HTML file. The application uses a gradient background and card-based layout for a modern look.
- A Nylas account with a configured application
- Valid Client ID from Nylas Dashboard
- Modern web browser with JavaScript enabled