-
Notifications
You must be signed in to change notification settings - Fork 31
task: documentation [#341] #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
9364d43
feat: docs site
slightfoot a8a2c85
fix: add documentation [#341]
shinyford 56e5aab
fix: remove doc deployment workflow [#341]
shinyford 39c8131
docs: badges for packages updated from v0.0.1 to v0.0.14-beta
MarkOSullivan94 f3d018e
docs: updated mentions of v0.0.13-beta to latest version
MarkOSullivan94 2d5761f
docs: fixed broken twitter link
MarkOSullivan94 d6782b4
docs: updated discord link
MarkOSullivan94 d5af957
docs: trimmed down repo README
MarkOSullivan94 85c84da
docs: added screenshots
MarkOSullivan94 069206b
docs(clerk_flutter): trimmed down readme
MarkOSullivan94 ed2f6ed
docs(clerk_auth): requirements table
MarkOSullivan94 d01b325
docs: updated clerk_flutter
MarkOSullivan94 aa973e5
docs: melos badge
MarkOSullivan94 e705db1
docs: added link to issues within beta notice
MarkOSullivan94 59b4342
docs(clerk_flutter): matching clerk doc website structure
MarkOSullivan94 304ea8d
docs(clerk_flutter): quickstart
MarkOSullivan94 0d89283
docs(clerk_flutter): install the sdk
MarkOSullivan94 eab2249
docs(clerk_flutter): configure the sdk
MarkOSullivan94 8f86a15
docs(clerk_flutter): clerk auth
MarkOSullivan94 3177ef2
docs(clerk_flutter): authentication flow
MarkOSullivan94 7dafaf9
docs(clerk_flutter): user management
MarkOSullivan94 045b3c0
docs(clerk_flutter): organization management
MarkOSullivan94 ab0d741
docs(clerk_flutter): overview
MarkOSullivan94 3379ae1
docs(clerk_flutter): clerk authentication
MarkOSullivan94 3be2006
docs(clerk_flutter): user views
MarkOSullivan94 afaf631
docs(clerk_flutter): customization
MarkOSullivan94 1d6c6eb
docs(clerk_flutter): sign in with google & apple and deploy to produc…
MarkOSullivan94 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,240 @@ | ||
| # Clerk SDK Documentation | ||
|
|
||
| Welcome to the comprehensive documentation for the Clerk SDK for Flutter and Dart. | ||
|
|
||
| ## 📚 Documentation Structure | ||
|
|
||
| This documentation is organized into two main sections: | ||
|
|
||
| ### 🎯 [clerk_auth](./clerk_auth/) - Core Dart SDK | ||
|
|
||
| The foundational authentication library that works with any Dart application. | ||
|
|
||
| **Start here if you're:** | ||
| - Building a Dart CLI application | ||
| - Integrating Clerk into a non-Flutter Dart project | ||
| - Understanding the core authentication logic | ||
| - Implementing custom UI or integrations | ||
|
|
||
| **Key Documentation:** | ||
| - [**Auth API**](./clerk_auth/auth.md) - Complete authentication methods (sign-in, sign-up, OAuth, passkeys, sessions, etc.) | ||
| - [**AuthConfig**](./clerk_auth/auth_config.md) - SDK configuration and initialization | ||
| - [**Persistor**](./clerk_auth/persistor.md) - Custom storage implementations | ||
| - [**HttpService**](./clerk_auth/http_service.md) - Custom HTTP client implementations | ||
|
|
||
| ### 🎨 [clerk_flutter](./clerk_flutter/) - Flutter Widgets | ||
|
|
||
| Pre-built Flutter widgets and UI components for rapid integration. | ||
|
|
||
| **Start here if you're:** | ||
| - Building a Flutter mobile or web application | ||
| - Looking for pre-built authentication UI | ||
| - Wanting quick integration with minimal code | ||
| - Customizing the appearance of auth flows | ||
|
|
||
| **Key Documentation:** | ||
| - [**ClerkAuth**](./clerk_flutter/clerk_auth.md) - Root widget and state management | ||
| - [**ClerkAuthentication**](./clerk_flutter/clerk_authentication.md) - Complete pre-built auth UI | ||
| - [**ClerkUserButton**](./clerk_flutter/clerk_user_button.md) - User profile and session management | ||
| - [**ClerkAuthBuilder**](./clerk_flutter/clerk_auth_builder.md) - Custom UI with builder pattern | ||
| - [**ClerkTheme**](./clerk_flutter/clerk_theme.md) - Theming and customization | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Quick Start | ||
|
|
||
| ### For Flutter Applications | ||
|
|
||
| 1. **Add dependencies** to your `pubspec.yaml`: | ||
| ```yaml | ||
| dependencies: | ||
| clerk_flutter: ^0.0.14-beta | ||
| ``` | ||
|
|
||
| 2. **Wrap your app** with `ClerkAuth`: | ||
| ```dart | ||
| MaterialApp( | ||
| builder: ClerkAuth.materialAppBuilder( | ||
| config: ClerkAuthConfig( | ||
| publishableKey: 'pk_test_...', | ||
| ), | ||
| ), | ||
| home: const HomePage(), | ||
| ) | ||
| ``` | ||
|
|
||
| 3. **Use pre-built UI** or build custom: | ||
| ```dart | ||
| // Pre-built UI | ||
| ClerkSignedOut( | ||
| child: const ClerkAuthentication(), | ||
| ) | ||
|
|
||
| // Custom UI | ||
| ClerkAuthBuilder( | ||
| signedInBuilder: (context, authState) { | ||
| return Text('Welcome, ${authState.user?.fullName}!'); | ||
| }, | ||
| signedOutBuilder: (context, authState) { | ||
| return const ClerkAuthentication(); | ||
| }, | ||
| ) | ||
| ``` | ||
|
|
||
| 📖 **[Full Flutter Guide →](./clerk_flutter/README.md)** | ||
|
|
||
| ### For Dart Applications | ||
|
|
||
| 1. **Add dependency** to your `pubspec.yaml`: | ||
| ```yaml | ||
| dependencies: | ||
| clerk_auth: ^0.0.14-beta | ||
| ``` | ||
|
|
||
| 2. **Initialize** the Auth instance: | ||
| ```dart | ||
| import 'package:clerk_auth/clerk_auth.dart'; | ||
|
|
||
| final auth = Auth( | ||
| config: AuthConfig(publishableKey: 'pk_test_...'), | ||
| ); | ||
| await auth.initialize(); | ||
| ``` | ||
|
|
||
| 3. **Authenticate** users: | ||
| ```dart | ||
| // Email + Password sign-in | ||
| await auth.attemptSignIn(identifier: 'user@example.com'); | ||
| await auth.attemptSignIn(password: 'password123'); | ||
|
|
||
| // Check auth state | ||
| if (auth.isSignedIn) { | ||
| print('User: ${auth.user?.fullName}'); | ||
| } | ||
| ``` | ||
|
|
||
| 📖 **[Full Dart Guide →](./clerk_auth/README.md)** | ||
|
|
||
| --- | ||
|
|
||
| ## 📖 Documentation Index | ||
|
|
||
| ### clerk_auth (Core SDK) | ||
|
|
||
| | Document | Description | | ||
| |----------|-------------| | ||
| | [README](./clerk_auth/README.md) | Overview and getting started | | ||
| | [Auth](./clerk_auth/auth.md) | Complete API reference for authentication methods | | ||
| | [AuthConfig](./clerk_auth/auth_config.md) | Configuration options and initialization | | ||
| | [Persistor](./clerk_auth/persistor.md) | Storage interface for sessions and tokens | | ||
| | [HttpService](./clerk_auth/http_service.md) | HTTP client interface for custom networking | | ||
|
|
||
| ### clerk_flutter (Flutter Widgets) | ||
|
|
||
| | Document | Description | | ||
| |----------|-------------| | ||
| | [README](./clerk_flutter/README.md) | Overview and getting started | | ||
| | [ClerkAuth](./clerk_flutter/clerk_auth.md) | Root widget and state management | | ||
| | [ClerkAuthBuilder](./clerk_flutter/clerk_auth_builder.md) | Builder pattern for custom UI | | ||
| | [ClerkAuthentication](./clerk_flutter/clerk_authentication.md) | Pre-built authentication UI | | ||
| | [ClerkUserButton](./clerk_flutter/clerk_user_button.md) | User profile button and menu | | ||
| | [ClerkOrganizationList](./clerk_flutter/clerk_organization_list.md) | Organization management UI | | ||
| | [ClerkSignedIn](./clerk_flutter/clerk_signed_in.md) | Conditional rendering (signed in) | | ||
| | [ClerkSignedOut](./clerk_flutter/clerk_signed_out.md) | Conditional rendering (signed out) | | ||
| | [ClerkErrorListener](./clerk_flutter/clerk_error_listener.md) | Error handling and display | | ||
| | [ClerkAuthConfig](./clerk_flutter/clerk_auth_config.md) | Flutter-specific configuration | | ||
| | [ClerkTheme](./clerk_flutter/clerk_theme.md) | Theming and customization | | ||
|
|
||
| --- | ||
|
|
||
| ## 🎯 Common Use Cases | ||
|
|
||
| ### Authentication Flows | ||
|
|
||
| - **[Email + Password Sign-In](./clerk_auth/auth.md#email--password-sign-in)** - Traditional authentication | ||
| - **[Email Code Sign-In](./clerk_auth/auth.md#email-code-sign-in)** - Passwordless with verification code | ||
| - **[Phone Code Sign-In](./clerk_auth/auth.md#phone-code-sign-in)** - SMS-based authentication | ||
| - **[OAuth Sign-In](./clerk_auth/auth.md#oauth-sign-in)** - Social login (Google, Apple, GitHub, etc.) | ||
| - **[Passkey Authentication](./clerk_auth/auth.md#passkey-authentication)** - WebAuthn/FIDO2 | ||
| - **[Multi-Factor Authentication](./clerk_auth/auth.md#multi-factor-authentication)** - 2FA with SMS or TOTP | ||
|
|
||
| ### Session Management | ||
|
|
||
| - **[Session Handling](./clerk_auth/auth.md#session-management)** - Managing user sessions | ||
| - **[Multi-Session Support](./clerk_auth/auth.md#multi-session-management)** - Multiple accounts | ||
| - **[Token Management](./clerk_auth/auth.md#token-management)** - Access tokens and JWTs | ||
|
|
||
| ### User Management | ||
|
|
||
| - **[User Profile](./clerk_auth/auth.md#user-management)** - Updating user information | ||
| - **[Email Management](./clerk_auth/auth.md#email-management)** - Adding/removing emails | ||
| - **[Phone Management](./clerk_auth/auth.md#phone-management)** - Adding/removing phone numbers | ||
| - **[External Accounts](./clerk_auth/auth.md#external-account-management)** - OAuth connections | ||
|
|
||
| ### Organization Features | ||
|
|
||
| - **[Organization Management](./clerk_auth/auth.md#organization-management)** - Creating and managing orgs | ||
| - **[Organization Switching](./clerk_auth/auth.md#switching-organizations)** - Multi-org support | ||
| - **[Organization UI](./clerk_flutter/clerk_organization_list.md)** - Pre-built organization widgets | ||
|
|
||
| --- | ||
|
|
||
| ## 🔑 Key Concepts | ||
|
|
||
| ### Re-entrant Authentication | ||
|
|
||
| The `attemptSignIn()` and `attemptSignUp()` methods are **re-entrant**, meaning you call them multiple times with different parameters to progress through the authentication flow: | ||
|
|
||
| ```dart | ||
| // Step 1: Provide identifier | ||
| await auth.attemptSignIn(identifier: 'user@example.com'); | ||
|
|
||
| // Step 2: Provide password | ||
| await auth.attemptSignIn(password: 'password123'); | ||
|
|
||
| // Step 3: If 2FA enabled, provide code | ||
| await auth.attemptSignIn(code: '123456'); | ||
| ``` | ||
|
|
||
| 📖 **[Learn more about re-entrant flows →](./clerk_auth/auth.md#re-entrant-methods)** | ||
|
|
||
| ### Transfer Flow | ||
|
|
||
| When using OAuth or ID token authentication, Clerk uses a "transfer flow" to securely complete authentication: | ||
|
|
||
| ```dart | ||
| // 1. Initiate OAuth | ||
| final transfer = await auth.oauthSignIn(strategy: Strategy.oauth_google); | ||
|
|
||
| // 2. Open browser to transfer.authUrl | ||
|
|
||
| // 3. Complete after redirect | ||
| await auth.completeOAuthSignIn(transfer: transfer); | ||
| ``` | ||
|
|
||
| 📖 **[Learn more about transfer flow →](./clerk_auth/auth.md#transfer-flow)** | ||
|
|
||
| --- | ||
|
|
||
| ## 💡 Best Practices | ||
|
|
||
| 1. **Use environment variables** for publishable keys | ||
| 2. **Handle errors** with `ClerkErrorListener` (Flutter) or try-catch blocks (Dart) | ||
| 3. **Respect re-entrant flows** - call `attemptSignIn`/`attemptSignUp` multiple times | ||
| 4. **Check auth state** before accessing user/session data | ||
| 5. **Implement proper loading states** during authentication | ||
| 6. **Test all authentication strategies** enabled in your Clerk Dashboard | ||
| 7. **Customize themes** to match your brand (Flutter) | ||
|
|
||
| --- | ||
|
|
||
| ## 🆘 Support | ||
|
|
||
| - **Clerk Dashboard**: [https://dashboard.clerk.com](https://dashboard.clerk.com) | ||
| - **Clerk Documentation**: [https://clerk.com/docs](https://clerk.com/docs) | ||
| - **GitHub Issues**: Report bugs and request features | ||
|
|
||
| --- | ||
|
|
||
| *Documentation generated for Clerk SDK version 0.0.14-beta* | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.