docs: add flutterflow auth kit integration guide

This commit is contained in:
Nishantjain10
2025-04-23 02:00:30 +05:30
parent 6d12d1a22d
commit 0ddb59451c

View File

@@ -0,0 +1,216 @@
---
layout: integration
title: Appwrite Authentication Kit
description: Seamlessly integrate secure user authentication into your FlutterFlow apps—without writing complex code.
date: 2024-03-01
featured: true
isPartner: true
isNew: true
cover: /images/integrations/flutterflow-auth-kit/cover.png
category: auth
product:
avatar: '/images/integrations/avatars/flutterflow.png'
vendor: FlutterFlow
description: 'Appwrite is a secure, open-source backend server for web, mobile, and Flutter developers.'
platform:
- 'Self-hosted'
- 'Cloud'
images:
- /images/integrations/flutterflow-auth-kit/cover.png
- /images/integrations/flutterflow-auth-kit/featured.png
- /images/integrations/flutterflow-auth-kit/auth-login-overview.png
- /images/integrations/flutterflow-auth-kit/login-pointers.png
- /images/integrations/flutterflow-auth-kit/dashboard-pointers.png
---
FlutterFlow is a powerful visual builder that lets you create beautiful Flutter apps without writing much code. It's perfect for both beginners and experienced developers who want to build apps quickly. With its drag-and-drop interface and pre-built components, you can focus on creating great user experiences.
# What youll build
As you start creating your FlutterFlow app, you might want to add user accounts for things like social media features or task management. To help you with this, we've made it super easy to implement secure authentication using our official [Authentication library](https://marketplace.flutterflow.io/item/h1gn6StcXy6imjg7Ykr2). This guide will walk you through everything you need to know to get up and running with Appwrite authentication in your FlutterFlow project.
By the end of this guide, youll have a fully functional authentication system with:
- Email/password sign-up and login
- Secure session management
- User profile handling
- Error handling with user feedback
- Protected routes for authenticated users
Want to see the final result first? Check out our [Appwrite Flutterflow Demo App](https://app.flutterflow.io/project/appwrite-auth-yxmd9b) to experience all these features in action! Then follow along to build your own custom version.
![Welcome screen](/images/integrations/flutterflow-auth-kit/welcomescreen.png)
# Before you start
Heres what youll need to have ready:
- [Appwrite account](https://cloud.appwrite.io/console/register)
- [FlutterFlow account](https://app.flutterflow.io/create-account)
- [FlutterFlow Marketplace account](https://marketplace.flutterflow.io/login) (must use the same email as your FlutterFlow account)
- Basic understanding of FlutterFlows interface
## Step 1: Setting up your Appwrite project
Lets start by getting your Appwrite project ready:
1. Head over to the [Appwrite Console](https://cloud.appwrite.io/)
2. Create a new project (give it a name that makes sense for your app)
3. Choose Flutter as your platform
4. Configure the platform settings by adding these domains:
| Purpose | Domains |
|------------------------|----------------------|
| Local testing | localhost |
| FlutterFlow web testing | `.web.app`, `.run.app` |
Note: Save your Project ID youll need it for the next steps
## Step 2: Adding the authentication library
The Authentication library provides essential core functionality:
- Pre-configured Custom Actions for authentication
- App States for session management
- Built-in Error Handling
- User Session Management
- Custom Data Types for type-safe responses
### Heres how to add it to your project:
1. Visit the [FlutterFlow Marketplace](https://marketplace.flutterflow.io/)
2. Search for “Appwrite Authentication Kit” or visit [Appwrite Authentication Kit](https://marketplace.flutterflow.io/item/h1gn6StcXy6imjg7Ykr2)
3. Click “Add” to add it to your marketplace account
4. In your FlutterFlow project:
- Navigate to `Project Settings > Project Dependencies`
- Find “Appwrite Authentication Kit” under FlutterFlow Libraries
- Click “Add Library”
![Screenshot of login](/images/integrations/flutterflow-auth-kit/screenshot.png)
## Step 3: Understanding the components
### App states:
The library sets up two essential app states:
- `appwriteConfig`: Stores configuration details securely
- `appwriteUser`: Manages user session information
Both states are automatically configured with:
- String data type
- Persistence enabled
- Authentication flow readiness
### Custom Data Types:
The library provides two custom data types for type-safe responses:
1. `AppwriteUser`: Represents user data
- Fields: id, email, name, emailVerified, status
- Used for: Storing and passing user information
2. `AppwriteUserResponse`: Standard response format
- Fields: success, error, errorCode, errorType, formattedError, user
- Used for: Consistent error handling and success responses
### Authentication actions:
The library provides five essential custom actions:
1. `initialize`
- Purpose: Sets up your Appwrite configuration
- Returns: `AppwriteUserResponse` with initialization status
- Must be called before any other authentication action
2. `signUpWithEmailAndPassword`
- Parameters: email, password
- Returns: `AppwriteUserResponse` with user data
- Handles: Account creation and session setup
3. `signInWithEmail`
- Parameters: email, password
- Returns: `AppwriteUserResponse` with session data
- Manages: User login process
4. `signOut`
- No parameters required
- Returns: `AppwriteUserResponse` with success status
- Handles: Complete session cleanup
5. `getCurrentUser`
- No parameters required
- Returns: `AppwriteUserResponse` with current user data
- Perfect for: Authentication state checks
### Understanding action flows:
Each authentication action follows this consistent pattern:
1. Action execution
2. Response handling using `AppwriteUserResponse`
3. Success/failure conditions based on `response.success`
4. Error handling using `response.formattedError`
![Flow example](/images/integrations/flutterflow-auth-kit/flow.png)
### Example: Setting up Initialize action
1. Configure Library Values:
- API Endpoint: `https://cloud.appwrite.io/v1`
- Project ID: `Your Appwrite project ID`
2. Drop an `initialize` action in your startup flow
3. Add a condition to check `initializeResult.success`
4. On success: Navigate to success page
5. On failure: Show `initializeResult.formattedError`
### Example: Sign Up flow
1. Use the `signUpWithEmailAndPassword` action
2. Check `signUpResult.success`
3. Success? → Dashboard
4. Failure? → Show `signUpResult.formattedError`
You can implement similar flow patterns for other authentication actions (`signInWithEmail`, `signOut`, `getCurrentUser`), following the similar structure of checking results and handling success/failure scenarios appropriately.
## See it in action:
Want to see how it all comes together? Check out our [Appwrite Flutterflow Demo App](https://app.flutterflow.io/project/appwrite-auth-yxmd9b) where you can check all custom actions in use:
- User registration process
- Login flow
- Session management
- Error handling
- Profile management
## Troubleshooting common issues
1. **Library Not Found**
- Verify marketplace account email matches FlutterFlow account
- Check if library is properly added in Project Dependencies
2. **Authentication Failures**
- Confirm `initialize` action is called first
- Verify endpoint and projectId values
- Check Appwrite console for platform settings
3. **Session Management Issues**
- Ensure app states are properly configured
- Verify persistence settings
This completes our guide on setting up Appwrite authentication in your FlutterFlow app. You now have a solid foundation for managing user accounts and secure sessions.
Now that you have the basics in place, you can enhance your app by implementing more advanced authentication features using Appwrite. If you run into any issues or have questions, the [Appwrite community on Discord](https://appwrite.io/discord) and the [FlutterFlow Community](https://community.flutterflow.io/) are always ready to help. Don't hesitate to reach out!
## More resources
If you would like to learn more about Appwrite and FlutterFlow, we have some resources that you should visit:
- [Appwrite Flutterflow Demo App](https://app.flutterflow.io/project/appwrite-auth-yxmd9b)
- [Appwrite Documentation](https://appwrite.io/docs)
- [FlutterFlow Marketplace](https://marketplace.flutterflow.io/item/h1gn6StcXy6imjg7Ykr2)