Skip to content
Closed
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
10 changes: 8 additions & 2 deletions .github/workflows/supabase_flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ jobs:
run: |
cd ../../
dart pub global activate melos
melos bootstrap
melos bootstrap --ignore="supabase_flutter_example"

- name: Bootstrap example
if: ${{ matrix.flutter-version == '3.x' }}
run: |
cd ../../
melos bootstrap --scope="supabase_flutter_example"

- name: Run formatter
if: ${{ matrix.flutter-version == '3.x'}}
Expand Down Expand Up @@ -104,7 +110,7 @@ jobs:
if: ${{ matrix.os == 'ubuntu-latest' && matrix.flutter-version == '3.x'}}
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev
sudo apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev libsecret-1-dev
cd example
flutter build linux

Expand Down
30 changes: 30 additions & 0 deletions packages/supabase_flutter/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,33 @@ create policy "Anyone can update an avatar." on storage.objects
- Flutter user management: https://github.com/supabase/supabase/tree/master/examples/user-management/flutter-user-management
- Extended flutter user management with web support, github login, recovery password flow: https://github.com/phamhieu/supabase-flutter-demo
- Real time chat application: https://github.com/supabase-community/flutter-chat

## Facebook SDK login setup

This example uses `flutter_facebook_auth` and `signInWithIdToken`. To make the
SDK login work end-to-end, configure Facebook and Supabase, then update the
platform files below.

### Supabase

- Enable Facebook in Auth providers.
- Add your Facebook App ID and App Secret in the Supabase dashboard.

### Android

1. Update `android/app/src/main/res/values/strings.xml`:
- `facebook_app_id`
- `facebook_client_token`
- `fb_login_protocol_scheme` (use `fb<APP_ID>`)
2. Ensure `android/app/src/main/AndroidManifest.xml` keeps the Facebook
activity and metadata entries.
3. Add your package name and key hashes in the Facebook developer console.

### iOS

1. Update `ios/Runner/Info.plist`:
- `FacebookAppID`
- `FacebookClientToken`
- `CFBundleURLTypes` scheme `fb<APP_ID>`
2. Ensure `ios/Runner/AppDelegate.swift` initializes `FBSDKCoreKit`.
3. Add your bundle ID in the Facebook developer console.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
android:label="example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.facebook.sdk.ClientToken"
android:value="@string/facebook_client_token" />

<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>

<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">example</string>
<string name="facebook_app_id">YOUR_FACEBOOK_APP_ID</string>
<string name="facebook_client_token">YOUR_FACEBOOK_CLIENT_TOKEN</string>
<string name="fb_login_protocol_scheme">fbYOUR_FACEBOOK_APP_ID</string>
</resources>
44 changes: 38 additions & 6 deletions packages/supabase_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
PODS:
- app_links (0.0.2):
- app_links (7.0.0):
- Flutter
- FBAEMKit (18.0.2):
- FBSDKCoreKit_Basics (= 18.0.2)
- FBSDKCoreKit (18.0.2):
- FBAEMKit (= 18.0.2)
- FBSDKCoreKit_Basics (= 18.0.2)
- FBSDKCoreKit_Basics (18.0.2)
- FBSDKLoginKit (18.0.2):
- FBSDKCoreKit (= 18.0.2)
- Flutter (1.0.0)
- flutter_facebook_auth (7.1.5):
- FBSDKLoginKit (= 18.0.2)
- Flutter
- flutter_secure_storage (6.0.0):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
Expand All @@ -14,15 +27,28 @@ PODS:
DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- Flutter (from `Flutter`)
- flutter_facebook_auth (from `.symlinks/plugins/flutter_facebook_auth/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
- FBAEMKit
- FBSDKCoreKit
- FBSDKCoreKit_Basics
- FBSDKLoginKit

EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
Flutter:
:path: Flutter
flutter_facebook_auth:
:path: ".symlinks/plugins/flutter_facebook_auth/ios"
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
shared_preferences_foundation:
Expand All @@ -31,12 +57,18 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_ios/ios"

SPEC CHECKSUMS:
app_links: f3e17e4ee5e357b39d8b95290a9b2c299fca71c6
app_links: a754cbec3c255bd4bbb4d236ecc06f28cd9a7ce8
FBAEMKit: 56a4f5a9607957b547b6458b17a98c5bb2736367
FBSDKCoreKit: 54f1240567e16862ab71c53c33dc347db5c524c5
FBSDKCoreKit_Basics: eb530cd6a79030dbb11df460aafb2767bcad9028
FBSDKLoginKit: 6a70798793e499335a98fab1a758d7da34af196e
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
flutter_facebook_auth: fa3b69b1df0831d2178fe87a05ee2d7d0156db70
flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b

PODFILE CHECKSUM: 0dbd5a87e0ace00c9610d2037ac22083a01f861d

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
9F7A42A0F8397A30C48EF6B6 /* Pods-Runner.release.xcconfig */,
FC8416E7A50F84EA287634DD /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -359,13 +358,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ELTTE7K8TT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
PRODUCT_BUNDLE_IDENTIFIER = "com.supabase.supabase-flutter";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -487,13 +487,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ELTTE7K8TT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
PRODUCT_BUNDLE_IDENTIFIER = "com.supabase.supabase-flutter";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -509,13 +510,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ELTTE7K8TT;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
PRODUCT_BUNDLE_IDENTIFIER = "com.supabase.supabase-flutter";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
16 changes: 16 additions & 0 deletions packages/supabase_flutter/example/ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import UIKit
import Flutter
import FBSDKCoreKit

@main
@objc class AppDelegate: FlutterAppDelegate {
Expand All @@ -8,6 +9,21 @@ import Flutter
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
ApplicationDelegate.shared.application(
application,
didFinishLaunchingWithOptions: launchOptions
)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

override func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
if ApplicationDelegate.shared.application(app, open: url, options: options) {
return true
}
return super.application(app, open: url, options: options)
}
}
30 changes: 26 additions & 4 deletions packages/supabase_flutter/example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand All @@ -20,10 +22,34 @@
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fbYOUR_FACEBOOK_APP_ID</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FacebookAppID</key>
<string>YOUR_FACEBOOK_APP_ID</string>
<key>FacebookClientToken</key>
<string>YOUR_FACEBOOK_CLIENT_TOKEN</string>
<key>FacebookDisplayName</key>
<string>Example</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -43,9 +69,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
Loading
Loading