feat(dart): Add Google Sign-In template
Description
This PR adds a new Dart template for Google Sign-In authentication with Appwrite Functions. The template verifies Google ID tokens and creates or updates Appwrite users accordingly.
What's Added
- New Template:
dart/sign_in_with_google- Token verification using Google's official tokeninfo endpoint
- Automatic user creation or retrieval
- Email verification status synchronization
- Session token generation for Appwrite authentication
Features
β Security Validations:
- Client ID (audience) verification
- Token issuer validation (ensures token is from Google)
- Expiration time checks
- Official Google tokeninfo endpoint usage
β User Management:
- Finds existing users by ID or email
- Creates new users if they don't exist
- Syncs email verification status from Google to Appwrite
- Returns session token for client-side authentication
Files Added
dart/sign_in_with_google/lib/main.dart- Main function implementationdart/sign_in_with_google/pubspec.yaml- Dart dependenciesdart/sign_in_with_google/README.md- Comprehensive documentation with usage examplesdart/sign_in_with_google/analysis_options.yaml- Linting configurationdart/sign_in_with_google/.gitignore- Git ignore rules
Documentation
The README includes:
- Function overview and workflow
- API usage with request/response examples
- Configuration requirements
- Environment variables setup
- Client-side integration guide using
google_sign_inpackage - Security notes and best practices
Testing
The template follows the same pattern as the existing sign_in_with_apple template and uses:
dart_appwriteSDK for Appwrite integrationhttppackage for Google API communication- Official Google tokeninfo endpoint for secure token verification
References
- Google Sign-In Package
- Google ID Token Verification Guide
- https://github.com/appwrite/appwrite/issues/9015
Summary by CodeRabbit
Summary by CodeRabbit
-
New Features
- Google Sign-In authentication with user lookup/creation, email verification handling, and session token issuance.
-
Documentation
- Added usage and configuration guide with request/response examples, client integration snippet, and security notes.
-
Chores
- Added package manifest, lint configuration, and ignore patterns for Dart tooling and lockfiles.
βοΈ Tip: You can customize this high-level summary in your review settings.
Walkthrough
Adds a new Dart package sign_in_with_google with project metadata and tooling files (.gitignore, analysis_options.yaml, pubspec.yaml, README.md) and a runtime at lib/main.dart. The runtime accepts a Google ID token, fetches Google JWKS, verifies JWT signature and claims (kid, audience against GOOGLE_CLIENT_ID, issuer, expiry), extracts user info (sub, email, email_verified, name), and uses Appwrite APIs to find or create a user, update email verification, generate an Appwrite access token, and return userId and token. Error handling covers missing/invalid tokens, key fetch/selection, verification failures, and Appwrite interactions.
Estimated code review effort
π― 3 (Moderate) | β±οΈ ~25 minutes
Files/areas to focus review on:
- dart/sign_in_with_google/lib/main.dart: JWKS fetch/caching and selection, JWT parsing/signature verification, audience/issuer/expiry checks, handling of email verification, Appwrite user lookup/create/update flows, and error branches.
- dart/sign_in_with_google/pubspec.yaml: dependency versions and SDK constraint.
- dart/sign_in_with_google/README.md: request/response schema, runtime/configuration, and security guidance accuracy.
- dart/sign_in_with_google/.gitignore and dart/sign_in_with_google/analysis_options.yaml: lint and ignore entries.
Pre-merge checks and finishing touches
β Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | β Passed | Check skipped - CodeRabbitβs high-level summary is enabled. |
| Title check | β Passed | The title 'feat(dart): Add Google Sign-In template' clearly and directly summarizes the main change: adding a new Google Sign-In authentication template for Dart. It is concise, specific, and accurately reflects the primary purpose of the changeset. |
| Docstring Coverage | β Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
β¨ Finishing touches
π§ͺ Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
[!TIP]
π Customizable high-level summaries are now available in beta!
You can now customize how CodeRabbit generates the high-level summary in your pull requests β including its content, structure, tone, and formatting.
- Provide your own instructions using the
high_level_summary_instructionssetting.- Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
- Use
high_level_summary_in_walkthroughto move the summary from the description to the walkthrough section.Example instruction:
"Divide the high-level summary into five sections:
- π Description β Summarize the main change in 50β60 words, explaining what was done.
- π References β List relevant issues, discussions, documentation, or related PRs.
- π¦ Dependencies & Requirements β Mention any new/updated dependencies, environment variable changes, or configuration updates.
- π Contributor Summary β Include a Markdown table showing contributions:
| Contributor | Lines Added | Lines Removed | Files Changed |- βοΈ Additional Notes β Add any extra reviewer context. Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Related:
- https://github.com/appwrite/appwrite/issues/9015