Skip to content

chore: Examples project refactor #1210

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/title-validation.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# See https://github.com/amannn/action-semantic-pull-request
name: 'PR Title is Conventional'
name: "PR Title is Conventional"

on:
pull_request:
Expand Down Expand Up @@ -33,6 +33,3 @@ jobs:
revert
style
test
subjectPattern: ^[A-Z].+$
subjectPatternError: |
The subject of the PR must begin with an uppercase letter.
98 changes: 98 additions & 0 deletions packages/supabase_flutter/example/FACEBOOK_AUTH_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Facebook Authentication Setup

This guide explains how to set up Facebook authentication in the Supabase Examples app.

## Prerequisites

1. A Facebook Developer account
2. A Facebook App created in the Facebook Developer Console
3. Supabase project with Facebook OAuth configured

## Setup Steps

### 1. Facebook Developer Console Configuration

1. Go to [Facebook Developers](https://developers.facebook.com/)
2. Create a new app or use an existing one
3. Add "Facebook Login" product to your app
4. Configure your OAuth redirect URIs in Facebook Login settings:
- Add your Supabase project's Facebook OAuth callback URL
- Format: `https://[your-project-ref].supabase.co/auth/v1/callback`

### 2. Supabase Configuration

1. Go to your Supabase project dashboard
2. Navigate to Authentication > Providers
3. Enable Facebook provider
4. Enter your Facebook App ID and App Secret
5. Configure the redirect URL if needed

### 3. Flutter App Configuration

#### Android Configuration

The following files have been configured for you:

1. **AndroidManifest.xml** - Contains Facebook SDK configuration
2. **strings.xml** - Contains placeholder values for Facebook credentials

You need to update the following values in `android/app/src/main/res/values/strings.xml`:

```xml
<string name="facebook_app_id">YOUR_ACTUAL_FACEBOOK_APP_ID</string>
<string name="facebook_client_token">YOUR_ACTUAL_FACEBOOK_CLIENT_TOKEN</string>
<string name="fb_login_protocol_scheme">fbYOUR_ACTUAL_FACEBOOK_APP_ID</string>
```

#### iOS Configuration

The following files have been configured for you:

1. **Info.plist** - Contains Facebook SDK configuration

You need to update the following values in `ios/Runner/Info.plist`:

```xml
<key>FacebookAppID</key>
<string>YOUR_ACTUAL_FACEBOOK_APP_ID</string>
<key>FacebookClientToken</key>
<string>YOUR_ACTUAL_FACEBOOK_CLIENT_TOKEN</string>
```

And update the URL scheme:
```xml
<string>fbYOUR_ACTUAL_FACEBOOK_APP_ID</string>
```

## Getting Your Facebook Credentials

### App ID
1. Go to Facebook Developers Console
2. Select your app
3. Go to Settings > Basic
4. Copy the "App ID"

### Client Token
1. In the same Basic settings page
2. Copy the "Client Token"
3. If you don't see it, you may need to generate one

## Testing

1. Replace all placeholder values with your actual Facebook credentials
2. Run `flutter pub get` to install dependencies
3. Run the app and test the "Continue with Facebook" button
4. Ensure your Facebook app is configured to allow the bundle ID/package name of your Flutter app

## Troubleshooting

- **Android**: Make sure your package name in `android/app/build.gradle` matches what's configured in Facebook
- **iOS**: Make sure your bundle identifier matches what's configured in Facebook
- **Both platforms**: Ensure your Facebook app is not in "Development Mode" if testing with non-developer accounts
- Check that your Supabase Facebook OAuth configuration matches your Facebook app settings

## Security Notes

- Never commit real Facebook credentials to version control
- Consider using environment variables or secure configuration management
- Regularly rotate your Facebook Client Token
24 changes: 21 additions & 3 deletions packages/supabase_flutter/example/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
# Profile Example
# Supabase Flutter Examples

Basic example of how to signup/login using Supabase auth and read and write from your Supabase
database.
Comprehensive examples showcasing the Supabase Flutter library features including authentication, database operations, realtime subscriptions, and file storage.

## Features Included

- **Authentication**: Sign up, sign in, social login (Facebook), password reset, and session management
- **Database**: CRUD operations with PostgreSQL database
- **Realtime**: Listen to database changes in real-time using WebSocket connections
- **Storage**: File upload, download, and management functionality

## Getting Started

1. Set up your Supabase project at [https://supabase.com](https://supabase.com)
2. Copy your project URL and anon key
3. Set environment variables or update the default values in `lib/main.dart`:
```
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
```
4. Run the SQL setup below in your Supabase SQL editor
5. For Facebook authentication, follow the Facebook auth setup guide

## SQL

Expand Down
6 changes: 3 additions & 3 deletions packages/supabase_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ android {
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_11.toString()
}

defaultConfig {
Expand Down
36 changes: 36 additions & 0 deletions packages/supabase_flutter/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,41 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>

<!-- Facebook Configuration -->
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>facebook-login</string>
<key>CFBundleURLSchemes</key>
<array>
<string>fbYOUR_FACEBOOK_APP_ID</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>YOUR_FACEBOOK_APP_ID</string>
<key>FacebookClientToken</key>
<string>YOUR_FACEBOOK_CLIENT_TOKEN</string>
<key>FacebookDisplayName</key>
<string>Supabase Flutter Example</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131024</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api</string>
<string>fb-messenger-share-api</string>
</array>
</dict>
</plist>
Loading
Loading