The authentication issue has been resolved. The main problems were:
- Environment Variables Missing: The Appwrite configuration wasn't properly set up
- Authentication Flow: The
clientLoaderfunctions weren't handling user creation/retrieval correctly - Error Handling: Better error handling has been added for debugging
- Go to Appwrite Cloud or your self-hosted instance
- Create a new project or use an existing one
- Note down your:
- Project ID
- API Endpoint (usually
https://cloud.appwrite.io/v1) - Database ID
- Collections IDs
Update the .env file in your project root with your actual Appwrite details:
VITE_APPWRITE_API_ENDPOINT=https://cloud.appwrite.io/v1
VITE_APPWRITE_PROJECT_ID=your-actual-project-id
VITE_APPWRITE_API_KEY=your-api-key
VITE_APPWRITE_DATABASE_ID=your-database-id
VITE_APPWRITE_USERS_COLLECTION_ID=your-users-collection-id
VITE_APPWRITE_TRIPS_COLLECTION_ID=your-trips-collection-id- In your Appwrite console, go to Auth → Settings
- Add Google as an OAuth provider
- Configure the redirect URLs:
- Success:
http://localhost:5177/(or your domain) - Failure:
http://localhost:5177/sign-in
- Success:
Create two collections in your Appwrite database:
accountId(string, required)email(string, required)name(string, required)imageUrl(string, optional)joinedAt(datetime, required)
- Configure as needed for your trip data
- Make sure the server is running (
npm run dev) - Go to
http://localhost:5177/sign-in - Click "Sign in with Google"
- After successful authentication, you should be redirected to the home page
- Fixed
clientLoaderfunctions in both sign-in and page-layout components - Improved
storeUserDatafunction to handle user creation properly - Added debugging logs to track authentication flow
- Added environment variable validation
- Fixed OAuth redirect URLs
- Added proper error handling throughout the authentication flow
If you still have issues, check the browser console for error messages. The authentication flow now includes detailed logging to help identify any remaining issues.