├── .gitignore ├── .gitmodules ├── .metadata ├── README.md ├── firebase_auth_oauth ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── me │ │ └── amryousef │ │ └── apple │ │ └── auth │ │ └── firebase_auth_oauth │ │ ├── FirebaseAuthOAuthPlugin.kt │ │ └── FirebaseAuthOAuthPluginError.kt ├── example │ ├── .gitignore │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ ├── google-services.json │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── me │ │ │ │ │ │ └── amryousef │ │ │ │ │ │ └── apple │ │ │ │ │ │ └── auth │ │ │ │ │ │ └── firebase_apple_auth_example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── GoogleService-Info.plist │ │ │ ├── Info.plist │ │ │ ├── Runner-Bridging-Header.h │ │ │ └── Runner.entitlements │ │ └── firebase_app_id_file.json │ ├── lib │ │ ├── firebase_options.dart │ │ └── main.dart │ ├── pubspec.yaml │ └── web │ │ └── index.html ├── ios │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── FirebaseAuthOAuthPlugin+AppleSignIniOS13.swift │ │ ├── FirebaseAuthOAuthPlugin+OAuthSignIn.swift │ │ ├── FirebaseAuthOAuthPlugin.h │ │ ├── FirebaseAuthOAuthPlugin.m │ │ ├── FirebaseAuthOAuthPluginError.swift │ │ ├── FirebaseAuthOAuthViewController.swift │ │ └── PluginResult.swift │ └── firebase_auth_oauth.podspec ├── lib │ └── firebase_auth_oauth.dart └── pubspec.yaml ├── firebase_auth_oauth_platform_interface ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib │ ├── firebase_auth_oauth_platform_interface.dart │ └── method_channel_firebase_auth_oauth.dart └── pubspec.yaml ├── firebase_auth_oauth_web ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib │ └── firebase_auth_oauth_web.dart └── pubspec.yaml └── flutterw /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | .idea 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | *.iml 9 | .flutter-plugins 10 | *.lock 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".flutter"] 2 | path = .flutter 3 | url = https://github.com/flutter/flutter.git 4 | branch = stable 5 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 18cd7a3601bcffb36fdf2f679f763b5e827c2e8e 8 | channel: beta 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # firebase_auth_oauth 2 | 3 | A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth. It also includes support for Sign in by Apple for Firebase. 4 | This plugin supports Android, iOS and Web. 5 | OAuth flows are performed by opening pop-up on top of the application to allow the user to authenticate or the native flow in the case of sign in by apple. 6 | 7 | 8 | # Usage 9 | 10 | **You need to set up Firebase for your project first before using this plugin. Instructions can be found [here](https://firebase.flutter.dev/docs/overview).** 11 | 12 | - In your `pubspec.yaml` add 13 | 14 | ``` 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | firebase_auth: ^4.1.1 19 | firebase_core: ^2.1.1 20 | firebase_auth_oauth: ^1.2.2 21 | ``` 22 | 23 | - Then in your project just call 24 | 25 | ``` 26 | 27 | FirebaseUser user = await FirebaseAuthOAuth().openSignInFlow("A provider ID", [list of scopes], {custom parameters map}); 28 | 29 | // Sign-in by Apple example 30 | User user = await FirebaseAuthOAuth() 31 | .openSignInFlow("apple.com", ["email"], {"locale": "en"}); 32 | 33 | // Or you can link an existing logged-in user 34 | User user = await FirebaseAuthOAuth() 35 | .linkExistingUserWithCredentials("apple.com", ["email"], {"locale": "en"}); 36 | 37 | // Or if the OAuth credential result is needed, you can fetch provider auth result with one of the following 38 | OAuthCredential credential = await FirebaseAuthOAuth().signInOAuth("apple.com", ["email"], {"locale": "en"}); 39 | OAuthCredential credential = await FirebaseAuthOAuth().linkWithOAuth("apple.com", ["email"], {"locale": "en"}); 40 | USer user = FirebaseAuth.instance.currentUser; 41 | 42 | ``` 43 | Checkout [the example Widget](https://github.com/amrfarid140/firebase_auth_oauth/blob/main/firebase_auth_oauth/example/lib/main.dart). 44 | 45 | # Auth Providers Support 46 | 47 | | Name | Supported | 48 | | ------------- |:-------------:| 49 | | Apple | ✅ (Android, Web & iOS 13) | 50 | | Twitter | ✅ | 51 | | Github | ✅ | 52 | | Microsoft | ✅ | 53 | | Yahoo | ✅ | 54 | | Facebook | 🚫 | 55 | 56 | This plugin supports OAuth operations using `OAuthProvider` only with the exception 57 | to Sign in by Apple on iOS 13 where it uses the native `AuthenticationService`. 58 | 59 | # Error Handling 60 | 61 | Below are the error codes you might receive when using this plugin 62 | 63 | | Code | Meaning | 64 | | ------------- |:-------------:| 65 | | FirebaseAuthError | An error coming from `FirebaseAuth` SDK | 66 | | PluginError | An error coming from this plugin. e.g. Invalid arguments or null items | 67 | | PlatformError | An error coming from the native platform | 68 | 69 | -------------------------------------------------------------------------------- /firebase_auth_oauth/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.2.2 2 | * Updated `firebase_auth` to Version ^4.1.1 3 | * Updated `firebase_core` to Version ^2.1.1 4 | * Update README 5 | 6 | ## 1.2.1 7 | * Updated `firebase_auth` to Version ^4.1.1 8 | * Updated `firebase_core` to Version ^2.1.1 9 | 10 | ## 1.2.0 11 | 12 | * **[Breaking Change]** Update minimum flutter version to `1.20.0` 13 | * Use latest `_web` plugin version 14 | 15 | ## 1.1.0+1 16 | 17 | * Updated Android Example 18 | 19 | ## 1.1.0 20 | 21 | * set minimum iOS version to 11.4 22 | 23 | ## 1.0.3 24 | 25 | * Added `signInOAuth` and `linkWithOAuth` 26 | * Updated `firebase_auth` to Version ^3.0.1 27 | * Updated `firebase_core` to Version ^1.4.0 28 | 29 | ## 1.0.2 30 | 31 | * Updated `firebase_auth` to Version ^2.0.0 32 | * Updated `firebase_core` to Version ^1.3.0 33 | 34 | ## 1.0.1 35 | 36 | * Fixed `linkExistingUserWithCredentials` to avoid creating two users on Firebase. Thanks to @tiagocavalli & @mateusfccp 37 | . 38 | 39 | ## 1.0.0 40 | 41 | * Migrated to null safety 42 | * Updated `firebase_auth` to Version ^1.0.0 43 | * Updated `firebase_core` to Version ^1.0.0 44 | 45 | ## 0.2.4 46 | 47 | * Updated `firebase_auth` to Version ^0.20.0+1 48 | * Updated `firebase_core` to Version ^0.7.0 49 | 50 | ## 0.2.3 51 | 52 | * Replace CryptoKit pod with Apple's CryptoKit framework 53 | 54 | ## 0.2.2 55 | 56 | * Fixed crash on iOS when using Microsoft sign in. Thanks to [@camillobucciarelli](https://github.com/camillobucciarelli). 57 | 58 | ## 0.2.1 59 | * Fixed Firebase not initialised issue when using this plugin 60 | 61 | ## 0.2.0 62 | 63 | * Migrated to `firebase_auth` ^0.18.0+1 64 | * Migrated to `firebase_auth` ^0.5.0 65 | * Added `linkExistingUserWithCredentials` to link existing user with OAuth credentials 66 | 67 | ## 0.1.1+1 68 | 69 | * Fixed type in README 70 | 71 | ## 0.1.1 72 | 73 | * Improved error handling across iOS and Android 74 | * Consistent error behaviour across platforms 75 | 76 | ## 0.1.0+8 77 | 78 | * Updated firebase_auth to Version ^0.16.1 79 | * Updated firebase_core to Version ^0.4.5 80 | 81 | ## 0.1.0+7 82 | 83 | * Updated firebase_auth to Version ^0.16.0 84 | 85 | ## 0.1.0+6 86 | 87 | * Downgraded Firebase version 0.15.3 88 | 89 | ## 0.1.0+5 90 | 91 | * Use Firebase version 0.15.4 92 | 93 | ## 0.1.0+4 94 | 95 | * Updated Firebase version 96 | 97 | ## 0.1.0+3 98 | 99 | * Updated example 100 | 101 | ## 0.1.0+2 102 | 103 | * Fix release builds on iOS 104 | 105 | ## 0.1.0+1 106 | 107 | * Fix builds on iOS 108 | 109 | ## 0.1.0 110 | 111 | * Initial release 112 | -------------------------------------------------------------------------------- /firebase_auth_oauth/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Amr Yousef 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /firebase_auth_oauth/README.md: -------------------------------------------------------------------------------- 1 | # firebase_auth_oauth 2 | 3 | A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth. It also includes support for Sign in by Apple for Firebase. 4 | This plugin supports Android, iOS and Web. 5 | OAuth flows are performed by opening pop-up on top of the application to allow the user to authenticate or the native flow in the case of sign in by apple. 6 | 7 | 8 | # Usage 9 | 10 | **You need to set up Firebase for your project first before using this plugin. Instructions can be found [here](https://firebase.flutter.dev/docs/overview).** 11 | 12 | - In your `pubspec.yaml` add 13 | 14 | ``` 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | firebase_auth: ^4.1.1 19 | firebase_core: ^2.1.1 20 | firebase_auth_oauth: ^1.2.2 21 | ``` 22 | 23 | - Then in your project just call 24 | 25 | ``` 26 | 27 | FirebaseUser user = await FirebaseAuthOAuth().openSignInFlow("A provider ID", [list of scopes], {custom parameters map}); 28 | 29 | // Sign-in by Apple example 30 | User user = await FirebaseAuthOAuth() 31 | .openSignInFlow("apple.com", ["email"], {"locale": "en"}); 32 | 33 | // Or you can link an existing logged-in user 34 | User user = await FirebaseAuthOAuth() 35 | .linkExistingUserWithCredentials("apple.com", ["email"], {"locale": "en"}); 36 | 37 | // Or if the OAuth credential result is needed, you can fetch provider auth result with one of the following 38 | OAuthCredential credential = await FirebaseAuthOAuth().signInOAuth("apple.com", ["email"], {"locale": "en"}); 39 | OAuthCredential credential = await FirebaseAuthOAuth().linkWithOAuth("apple.com", ["email"], {"locale": "en"}); 40 | USer user = FirebaseAuth.instance.currentUser; 41 | 42 | ``` 43 | Checkout [the example Widget](https://github.com/amrfarid140/firebase_auth_oauth/blob/main/firebase_auth_oauth/example/lib/main.dart). 44 | 45 | # Auth Providers Support 46 | 47 | | Name | Supported | 48 | | ------------- |:-------------:| 49 | | Apple | ✅ (Android, Web & iOS 13) | 50 | | Twitter | ✅ | 51 | | Github | ✅ | 52 | | Microsoft | ✅ | 53 | | Yahoo | ✅ | 54 | | Facebook | 🚫 | 55 | 56 | This plugin supports OAuth operations using `OAuthProvider` only with the exception 57 | to Sign in by Apple on iOS 13 where it uses the native `AuthenticationService`. 58 | 59 | # Error Handling 60 | 61 | Below are the error codes you might receive when using this plugin 62 | 63 | | Code | Meaning | 64 | | ------------- |:-------------:| 65 | | FirebaseAuthError | An error coming from `FirebaseAuth` SDK | 66 | | PluginError | An error coming from this plugin. e.g. Invalid arguments or null items | 67 | | PlatformError | An error coming from the native platform | 68 | 69 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'me.amryousef.apple.auth.firebase_apple_auth' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | ext.kotlin_version = '1.4.0' 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | 11 | dependencies { 12 | classpath 'com.android.tools.build:gradle:3.5.4' 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | rootProject.allprojects { 18 | repositories { 19 | google() 20 | jcenter() 21 | } 22 | } 23 | 24 | apply plugin: 'com.android.library' 25 | apply plugin: 'kotlin-android' 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | sourceSets { 31 | main.java.srcDirs += 'src/main/kotlin' 32 | } 33 | defaultConfig { 34 | minSdkVersion 16 35 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 36 | } 37 | lintOptions { 38 | disable 'InvalidPackage' 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 44 | implementation 'com.google.firebase:firebase-auth' 45 | implementation "androidx.browser:browser:1.3.0" 46 | implementation 'com.google.code.gson:gson:2.8.6' 47 | } 48 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Dec 31 19:12:12 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'firebase_apple_auth' 2 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/src/main/kotlin/me/amryousef/apple/auth/firebase_auth_oauth/FirebaseAuthOAuthPlugin.kt: -------------------------------------------------------------------------------- 1 | package me.amryousef.apple.auth.firebase_auth_oauth 2 | 3 | import android.app.Activity 4 | import androidx.annotation.NonNull 5 | import com.google.firebase.FirebaseApp 6 | import com.google.firebase.auth.FirebaseAuth 7 | import com.google.firebase.auth.OAuthProvider 8 | import com.google.firebase.auth.AuthResult 9 | import com.google.firebase.auth.OAuthCredential 10 | import com.google.gson.Gson 11 | import com.google.gson.reflect.TypeToken 12 | import io.flutter.embedding.engine.plugins.FlutterPlugin 13 | import io.flutter.embedding.engine.plugins.activity.ActivityAware 14 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding 15 | import io.flutter.plugin.common.MethodCall 16 | import io.flutter.plugin.common.MethodChannel 17 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 18 | import io.flutter.plugin.common.MethodChannel.Result 19 | import io.flutter.plugin.common.PluginRegistry.Registrar 20 | 21 | 22 | /** FirebaseAppleAuthPlugin */ 23 | class FirebaseAuthOAuthPlugin : FlutterPlugin, ActivityAware, MethodCallHandler { 24 | 25 | private var activity: Activity? = null 26 | 27 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 28 | val channel = MethodChannel( 29 | flutterPluginBinding.binaryMessenger, 30 | "me.amryousef.apple.auth/firebase_auth_oauth" 31 | ) 32 | channel.setMethodCallHandler(this) 33 | } 34 | 35 | companion object { 36 | private const val CREATE_USER_METHOD = "signInOAuth" 37 | private const val LINK_USER_METHOD = "linkWithOAuth" 38 | 39 | @Suppress("unused", "deprecation") 40 | @JvmStatic 41 | fun registerWith(registrar: Registrar) { 42 | val channel = 43 | MethodChannel(registrar.messenger(), "me.amryousef.apple.auth/firebase_auth_oauth") 44 | channel.setMethodCallHandler(FirebaseAuthOAuthPlugin().apply { 45 | activity = registrar.activity() 46 | }) 47 | } 48 | } 49 | 50 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { 51 | val providerBuilder = 52 | call.argument("provider")?.let { OAuthProvider.newBuilder(it) } 53 | if (providerBuilder == null) { 54 | FirebaseAuthOAuthPluginError 55 | .PluginError("Provider argument cannot be null") 56 | .toResult(result) 57 | return 58 | } 59 | val gson = Gson() 60 | if (call.argument("scopes") == null) { 61 | FirebaseAuthOAuthPluginError 62 | .PluginError("Scope cannot be null") 63 | .toResult(result) 64 | return 65 | } 66 | call.argument("scopes")?.let { 67 | providerBuilder.setScopes(gson.fromJson(it, object : TypeToken>() {}.type)) 68 | } 69 | call.argument("parameters")?.let { 70 | providerBuilder.addCustomParameters( 71 | gson.fromJson>( 72 | it, 73 | object : TypeToken>() {}.type 74 | ) 75 | ) 76 | } 77 | val provider = providerBuilder.build() 78 | activity?.let { 79 | val auth = call.argument("app")?.let { appName -> 80 | FirebaseAuth.getInstance(FirebaseApp.getInstance(appName)) 81 | } ?: FirebaseAuth.getInstance() 82 | val pending = auth.pendingAuthResult 83 | pending?.addOnSuccessListener { 84 | result.success("") 85 | }?.addOnFailureListener { error -> 86 | FirebaseAuthOAuthPluginError 87 | .FirebaseAuthError(error) 88 | .toResult(result) 89 | } ?: run { 90 | val task = call.method.toSignInTask(provider, auth, result) 91 | task.addOnSuccessListener( 92 | fun (authResult: AuthResult) { 93 | val credential = authResult.getCredential() 94 | if (credential is OAuthCredential) { 95 | result.success(mapOf( 96 | "providerId" to authResult.getCredential()?.getProvider(), 97 | "accessToken" to credential.getAccessToken(), 98 | "idToken" to credential.getIdToken(), 99 | "secret" to credential.getSecret() 100 | )) 101 | } else { 102 | result.success(mapOf( 103 | "providerId" to authResult.getCredential()?.getProvider() 104 | )) 105 | } 106 | } 107 | ).addOnFailureListener { error -> 108 | FirebaseAuthOAuthPluginError 109 | .FirebaseAuthError(error) 110 | .toResult(result) 111 | } 112 | } 113 | } 114 | } 115 | 116 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 117 | } 118 | 119 | override fun onDetachedFromActivity() { 120 | activity = null 121 | } 122 | 123 | override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { 124 | activity = binding.activity 125 | } 126 | 127 | override fun onAttachedToActivity(binding: ActivityPluginBinding) { 128 | activity = binding.activity 129 | } 130 | 131 | override fun onDetachedFromActivityForConfigChanges() { 132 | activity = null 133 | } 134 | 135 | private fun String.toSignInTask( 136 | provider: OAuthProvider, 137 | auth: FirebaseAuth, 138 | result: Result 139 | ) = activity?.let { 140 | when (this) { 141 | LINK_USER_METHOD -> { 142 | val user = auth.currentUser 143 | if (user == null) { 144 | FirebaseAuthOAuthPluginError.PluginError( 145 | "" 146 | ).toResult(result) 147 | } 148 | user!!.startActivityForLinkWithProvider(it, provider) 149 | } 150 | CREATE_USER_METHOD -> { 151 | auth.startActivityForSignInWithProvider(it, provider) 152 | } 153 | else -> { 154 | FirebaseAuthOAuthPluginError.PluginError("Unknown method called") 155 | com.google.android.gms.tasks.Tasks.forCanceled() 156 | } 157 | } 158 | } ?: com.google.android.gms.tasks.Tasks.forCanceled() 159 | } 160 | -------------------------------------------------------------------------------- /firebase_auth_oauth/android/src/main/kotlin/me/amryousef/apple/auth/firebase_auth_oauth/FirebaseAuthOAuthPluginError.kt: -------------------------------------------------------------------------------- 1 | package me.amryousef.apple.auth.firebase_auth_oauth 2 | 3 | import io.flutter.plugin.common.MethodChannel.Result 4 | 5 | sealed class FirebaseAuthOAuthPluginError { 6 | data class FirebaseAuthError(val exception: Exception) : FirebaseAuthOAuthPluginError() 7 | data class PlatformError(val exception: Exception) : FirebaseAuthOAuthPluginError() 8 | data class PluginError(val error: String) : FirebaseAuthOAuthPluginError() 9 | 10 | val code: String 11 | get() { 12 | return when (this) { 13 | is FirebaseAuthError -> "FirebaseAuthError" 14 | is PlatformError -> "PlatformError" 15 | is PluginError -> "PluginError" 16 | } 17 | } 18 | } 19 | 20 | fun FirebaseAuthOAuthPluginError.toResult(result: Result) { 21 | when (this) { 22 | is FirebaseAuthOAuthPluginError.FirebaseAuthError -> 23 | result.error(code, exception.localizedMessage, exception) 24 | is FirebaseAuthOAuthPluginError.PlatformError -> 25 | result.error(code, exception.localizedMessage, exception) 26 | is FirebaseAuthOAuthPluginError.PluginError -> 27 | result.error(code, error, null) 28 | } 29 | } -------------------------------------------------------------------------------- /firebase_auth_oauth/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | # Exceptions to above rules. 37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 38 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 31 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "me.amryousef.apple.auth.firebase_apple_auth_example" 42 | minSdkVersion 16 43 | targetSdkVersion 31 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | signingConfigs { 50 | debug { 51 | storeFile file("$rootDir/debug.keystore") 52 | storePassword "amr123" 53 | keyAlias "key" 54 | keyPassword "amr123" 55 | } 56 | } 57 | 58 | buildTypes { 59 | release { 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | testImplementation 'junit:junit:4.12' 72 | androidTestImplementation 'androidx.test:runner:1.1.1' 73 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 74 | } 75 | 76 | apply plugin: 'com.google.gms.google-services' 77 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "719377316001", 4 | "firebase_url": "https://testfirestore-fd7e2.firebaseio.com", 5 | "project_id": "testfirestore-fd7e2", 6 | "storage_bucket": "testfirestore-fd7e2.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:719377316001:android:4645213cd6d24e0821d8e0", 12 | "android_client_info": { 13 | "package_name": "io.flutter.plugins.firebase.firestoreexample" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "719377316001-0bdvnammejjch8ua3ldsnf6de7lncks9.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "io.flutter.plugins.firebase.firestoreexample", 22 | "certificate_hash": "3deaf6bd95ee70307f02b8015a017dc45b2f7bec" 23 | } 24 | }, 25 | { 26 | "client_id": "719377316001-48dpu9t5vgpriguug42lq40fhik84em7.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyBFixEmrkbKZKTfU3ebkAzQLj4Xu6Y9B-Q" 33 | } 34 | ], 35 | "services": { 36 | "appinvite_service": { 37 | "other_platform_oauth_client": [ 38 | { 39 | "client_id": "719377316001-48dpu9t5vgpriguug42lq40fhik84em7.apps.googleusercontent.com", 40 | "client_type": 3 41 | }, 42 | { 43 | "client_id": "719377316001-5hritti5v3rkbptof9pg2efk4tialskn.apps.googleusercontent.com", 44 | "client_type": 2, 45 | "ios_info": { 46 | "bundle_id": "me.amryousef.apple.auth.firebaseAppleAuthExample" 47 | } 48 | } 49 | ] 50 | } 51 | } 52 | }, 53 | { 54 | "client_info": { 55 | "mobilesdk_app_id": "1:719377316001:android:985ce6c58aaa72cd21d8e0", 56 | "android_client_info": { 57 | "package_name": "me.amryousef.apple.auth.firebase_apple_auth_example" 58 | } 59 | }, 60 | "oauth_client": [ 61 | { 62 | "client_id": "719377316001-9otdqitotpa105j6liutfbnl2gv2l3dh.apps.googleusercontent.com", 63 | "client_type": 1, 64 | "android_info": { 65 | "package_name": "me.amryousef.apple.auth.firebase_apple_auth_example", 66 | "certificate_hash": "d3dcb5933d370267ccc8ebdac100514051e5a62b" 67 | } 68 | }, 69 | { 70 | "client_id": "719377316001-q2m2qbbng2gft2hu5gjel1p2d8gnk6ul.apps.googleusercontent.com", 71 | "client_type": 1, 72 | "android_info": { 73 | "package_name": "me.amryousef.apple.auth.firebase_apple_auth_example", 74 | "certificate_hash": "3deaf6bd95ee70307f02b8015a017dc45b2f7bec" 75 | } 76 | }, 77 | { 78 | "client_id": "719377316001-u6prh36m9ku1u5hj0oek8tgkeb6num6q.apps.googleusercontent.com", 79 | "client_type": 1, 80 | "android_info": { 81 | "package_name": "me.amryousef.apple.auth.firebase_apple_auth_example", 82 | "certificate_hash": "994d3d8f89b3ad435fc0c95b2e90449c53e58a88" 83 | } 84 | }, 85 | { 86 | "client_id": "719377316001-48dpu9t5vgpriguug42lq40fhik84em7.apps.googleusercontent.com", 87 | "client_type": 3 88 | } 89 | ], 90 | "api_key": [ 91 | { 92 | "current_key": "AIzaSyBFixEmrkbKZKTfU3ebkAzQLj4Xu6Y9B-Q" 93 | } 94 | ], 95 | "services": { 96 | "appinvite_service": { 97 | "other_platform_oauth_client": [ 98 | { 99 | "client_id": "719377316001-48dpu9t5vgpriguug42lq40fhik84em7.apps.googleusercontent.com", 100 | "client_type": 3 101 | }, 102 | { 103 | "client_id": "719377316001-5hritti5v3rkbptof9pg2efk4tialskn.apps.googleusercontent.com", 104 | "client_type": 2, 105 | "ios_info": { 106 | "bundle_id": "me.amryousef.apple.auth.firebaseAppleAuthExample" 107 | } 108 | } 109 | ] 110 | } 111 | } 112 | } 113 | ], 114 | "configuration_version": "1" 115 | } -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/kotlin/me/amryousef/apple/auth/firebase_apple_auth_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package me.amryousef.apple.auth.firebase_apple_auth_example 2 | 3 | import androidx.annotation.NonNull; 4 | import io.flutter.embedding.android.FlutterActivity 5 | import io.flutter.embedding.engine.FlutterEngine 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 10 | GeneratedPluginRegistrant.registerWith(flutterEngine); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.4.20' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath 'com.google.gms:google-services:4.3.3' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | rootProject.buildDir = '../build' 23 | subprojects { 24 | project.buildDir = "${rootProject.buildDir}/${project.name}" 25 | } 26 | subprojects { 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/android/debug.keystore -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Mar 06 11:26:02 GMT 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https://services.gradle.org/distributions/gradle-7.2-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 3 | #include "Generated.xcconfig" 4 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 3 | #include "Generated.xcconfig" 4 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '10.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 20E4A5068AAAA6292D4A240A /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AE7899FA51E2017C4BA6208 /* Pods_Runner.framework */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | A042F5F723BBFC860041C9F1 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A042F5F623BBFC860041C9F1 /* GoogleService-Info.plist */; }; 18 | F2345D9C919E85047FFE5E98 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = AD5733F4820BC8827023BA81 /* GoogleService-Info.plist */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXCopyFilesBuildPhase section */ 22 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 23 | isa = PBXCopyFilesBuildPhase; 24 | buildActionMask = 2147483647; 25 | dstPath = ""; 26 | dstSubfolderSpec = 10; 27 | files = ( 28 | ); 29 | name = "Embed Frameworks"; 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 07DBEB71ED5DD820B52F4662 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 36 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 37 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 38 | 1AE7899FA51E2017C4BA6208 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 260933D27D958FAC77C4098F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 40 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 41 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 42 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 43 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 44 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 45 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 46 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | A042F5F623BBFC860041C9F1 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; 52 | A042F5F823BBFF130041C9F1 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; 53 | AD5733F4820BC8827023BA81 /* GoogleService-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Runner/GoogleService-Info.plist"; sourceTree = ""; }; 54 | D2685C264D3EB475C1D0AD91 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 55 | /* End PBXFileReference section */ 56 | 57 | /* Begin PBXFrameworksBuildPhase section */ 58 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | 20E4A5068AAAA6292D4A240A /* Pods_Runner.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 73 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 74 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 75 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 76 | ); 77 | name = Flutter; 78 | sourceTree = ""; 79 | }; 80 | 97C146E51CF9000F007C117D = { 81 | isa = PBXGroup; 82 | children = ( 83 | 9740EEB11CF90186004384FC /* Flutter */, 84 | 97C146F01CF9000F007C117D /* Runner */, 85 | 97C146EF1CF9000F007C117D /* Products */, 86 | D1EB33AAF845CBD3386FDFBA /* Pods */, 87 | 98B6165349E720ACD71D34A0 /* Frameworks */, 88 | AD5733F4820BC8827023BA81 /* GoogleService-Info.plist */, 89 | ); 90 | sourceTree = ""; 91 | }; 92 | 97C146EF1CF9000F007C117D /* Products */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 97C146EE1CF9000F007C117D /* Runner.app */, 96 | ); 97 | name = Products; 98 | sourceTree = ""; 99 | }; 100 | 97C146F01CF9000F007C117D /* Runner */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | A042F5F823BBFF130041C9F1 /* Runner.entitlements */, 104 | A042F5F623BBFC860041C9F1 /* GoogleService-Info.plist */, 105 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 106 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 107 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 108 | 97C147021CF9000F007C117D /* Info.plist */, 109 | 97C146F11CF9000F007C117D /* Supporting Files */, 110 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 111 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 112 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 113 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | 98B6165349E720ACD71D34A0 /* Frameworks */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 1AE7899FA51E2017C4BA6208 /* Pods_Runner.framework */, 129 | ); 130 | name = Frameworks; 131 | sourceTree = ""; 132 | }; 133 | D1EB33AAF845CBD3386FDFBA /* Pods */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 07DBEB71ED5DD820B52F4662 /* Pods-Runner.debug.xcconfig */, 137 | 260933D27D958FAC77C4098F /* Pods-Runner.release.xcconfig */, 138 | D2685C264D3EB475C1D0AD91 /* Pods-Runner.profile.xcconfig */, 139 | ); 140 | path = Pods; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 97C146ED1CF9000F007C117D /* Runner */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 149 | buildPhases = ( 150 | EDF529B091EDB95DF857EFE2 /* [CP] Check Pods Manifest.lock */, 151 | 9740EEB61CF901F6004384FC /* Run Script */, 152 | 97C146EA1CF9000F007C117D /* Sources */, 153 | 97C146EB1CF9000F007C117D /* Frameworks */, 154 | 97C146EC1CF9000F007C117D /* Resources */, 155 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 156 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 157 | 0DC5230DF2A7C8FD99336A86 /* [CP] Embed Pods Frameworks */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | ); 163 | name = Runner; 164 | productName = Runner; 165 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 166 | productType = "com.apple.product-type.application"; 167 | }; 168 | /* End PBXNativeTarget section */ 169 | 170 | /* Begin PBXProject section */ 171 | 97C146E61CF9000F007C117D /* Project object */ = { 172 | isa = PBXProject; 173 | attributes = { 174 | LastUpgradeCheck = 1020; 175 | ORGANIZATIONNAME = "The Chromium Authors"; 176 | TargetAttributes = { 177 | 97C146ED1CF9000F007C117D = { 178 | CreatedOnToolsVersion = 7.3.1; 179 | DevelopmentTeam = P8C49CPC4X; 180 | LastSwiftMigration = 1100; 181 | }; 182 | }; 183 | }; 184 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 185 | compatibilityVersion = "Xcode 3.2"; 186 | developmentRegion = en; 187 | hasScannedForEncodings = 0; 188 | knownRegions = ( 189 | en, 190 | Base, 191 | ); 192 | mainGroup = 97C146E51CF9000F007C117D; 193 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 194 | projectDirPath = ""; 195 | projectRoot = ""; 196 | targets = ( 197 | 97C146ED1CF9000F007C117D /* Runner */, 198 | ); 199 | }; 200 | /* End PBXProject section */ 201 | 202 | /* Begin PBXResourcesBuildPhase section */ 203 | 97C146EC1CF9000F007C117D /* Resources */ = { 204 | isa = PBXResourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 208 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 209 | A042F5F723BBFC860041C9F1 /* GoogleService-Info.plist in Resources */, 210 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 211 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 212 | F2345D9C919E85047FFE5E98 /* GoogleService-Info.plist in Resources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXResourcesBuildPhase section */ 217 | 218 | /* Begin PBXShellScriptBuildPhase section */ 219 | 0DC5230DF2A7C8FD99336A86 /* [CP] Embed Pods Frameworks */ = { 220 | isa = PBXShellScriptBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | ); 224 | inputPaths = ( 225 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 226 | "${BUILT_PRODUCTS_DIR}/FirebaseAuth/FirebaseAuth.framework", 227 | "${BUILT_PRODUCTS_DIR}/FirebaseCore/FirebaseCore.framework", 228 | "${BUILT_PRODUCTS_DIR}/FirebaseCoreDiagnostics/FirebaseCoreDiagnostics.framework", 229 | "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", 230 | "${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework", 231 | "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", 232 | "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework", 233 | "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", 234 | ); 235 | name = "[CP] Embed Pods Frameworks"; 236 | outputPaths = ( 237 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseAuth.framework", 238 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCore.framework", 239 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FirebaseCoreDiagnostics.framework", 240 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", 241 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework", 242 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", 243 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework", 244 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | shellPath = /bin/sh; 248 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 249 | showEnvVarsInLog = 0; 250 | }; 251 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 252 | isa = PBXShellScriptBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | inputPaths = ( 257 | ); 258 | name = "Thin Binary"; 259 | outputPaths = ( 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | shellPath = /bin/sh; 263 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin\n"; 264 | }; 265 | 9740EEB61CF901F6004384FC /* Run Script */ = { 266 | isa = PBXShellScriptBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | ); 270 | inputPaths = ( 271 | ); 272 | name = "Run Script"; 273 | outputPaths = ( 274 | ); 275 | runOnlyForDeploymentPostprocessing = 0; 276 | shellPath = /bin/sh; 277 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 278 | }; 279 | EDF529B091EDB95DF857EFE2 /* [CP] Check Pods Manifest.lock */ = { 280 | isa = PBXShellScriptBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | ); 284 | inputFileListPaths = ( 285 | ); 286 | inputPaths = ( 287 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 288 | "${PODS_ROOT}/Manifest.lock", 289 | ); 290 | name = "[CP] Check Pods Manifest.lock"; 291 | outputFileListPaths = ( 292 | ); 293 | outputPaths = ( 294 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | shellPath = /bin/sh; 298 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 299 | showEnvVarsInLog = 0; 300 | }; 301 | /* End PBXShellScriptBuildPhase section */ 302 | 303 | /* Begin PBXSourcesBuildPhase section */ 304 | 97C146EA1CF9000F007C117D /* Sources */ = { 305 | isa = PBXSourcesBuildPhase; 306 | buildActionMask = 2147483647; 307 | files = ( 308 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 309 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 310 | ); 311 | runOnlyForDeploymentPostprocessing = 0; 312 | }; 313 | /* End PBXSourcesBuildPhase section */ 314 | 315 | /* Begin PBXVariantGroup section */ 316 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 317 | isa = PBXVariantGroup; 318 | children = ( 319 | 97C146FB1CF9000F007C117D /* Base */, 320 | ); 321 | name = Main.storyboard; 322 | sourceTree = ""; 323 | }; 324 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 325 | isa = PBXVariantGroup; 326 | children = ( 327 | 97C147001CF9000F007C117D /* Base */, 328 | ); 329 | name = LaunchScreen.storyboard; 330 | sourceTree = ""; 331 | }; 332 | /* End PBXVariantGroup section */ 333 | 334 | /* Begin XCBuildConfiguration section */ 335 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 336 | isa = XCBuildConfiguration; 337 | buildSettings = { 338 | ALWAYS_SEARCH_USER_PATHS = NO; 339 | CLANG_ANALYZER_NONNULL = YES; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 345 | CLANG_WARN_BOOL_CONVERSION = YES; 346 | CLANG_WARN_COMMA = YES; 347 | CLANG_WARN_CONSTANT_CONVERSION = YES; 348 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 349 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 350 | CLANG_WARN_EMPTY_BODY = YES; 351 | CLANG_WARN_ENUM_CONVERSION = YES; 352 | CLANG_WARN_INFINITE_RECURSION = YES; 353 | CLANG_WARN_INT_CONVERSION = YES; 354 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 366 | ENABLE_NS_ASSERTIONS = NO; 367 | ENABLE_STRICT_OBJC_MSGSEND = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_NO_COMMON_BLOCKS = YES; 370 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 371 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 372 | GCC_WARN_UNDECLARED_SELECTOR = YES; 373 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 374 | GCC_WARN_UNUSED_FUNCTION = YES; 375 | GCC_WARN_UNUSED_VARIABLE = YES; 376 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 377 | MTL_ENABLE_DEBUG_INFO = NO; 378 | SDKROOT = iphoneos; 379 | SUPPORTED_PLATFORMS = iphoneos; 380 | TARGETED_DEVICE_FAMILY = "1,2"; 381 | VALIDATE_PRODUCT = YES; 382 | }; 383 | name = Profile; 384 | }; 385 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 386 | isa = XCBuildConfiguration; 387 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 388 | buildSettings = { 389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 390 | CLANG_ENABLE_MODULES = YES; 391 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 392 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 393 | DEVELOPMENT_TEAM = P8C49CPC4X; 394 | ENABLE_BITCODE = NO; 395 | FRAMEWORK_SEARCH_PATHS = ( 396 | "$(inherited)", 397 | "$(PROJECT_DIR)/Flutter", 398 | ); 399 | INFOPLIST_FILE = Runner/Info.plist; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 401 | LIBRARY_SEARCH_PATHS = ( 402 | "$(inherited)", 403 | "$(PROJECT_DIR)/Flutter", 404 | ); 405 | OTHER_LDFLAGS = ( 406 | "$(inherited)", 407 | "-framework", 408 | Flutter, 409 | "$(inherited)", 410 | "-ObjC", 411 | "-l\"c++\"", 412 | "-l\"sqlite3\"", 413 | "-l\"z\"", 414 | "-framework", 415 | "\"AuthenticationServices\"", 416 | "-framework", 417 | "\"CryptoKit\"", 418 | "-framework", 419 | "\"FirebaseAuth\"", 420 | "-framework", 421 | "\"FirebaseCore\"", 422 | "-framework", 423 | "\"FirebaseCoreDiagnostics\"", 424 | "-framework", 425 | "\"Flutter\"", 426 | "-framework", 427 | "\"Foundation\"", 428 | "-framework", 429 | "\"GTMSessionFetcher\"", 430 | "-framework", 431 | "\"GoogleDataTransport\"", 432 | "-framework", 433 | "\"SafariServices\"", 434 | "-framework", 435 | "\"Security\"", 436 | "-framework", 437 | "\"StoreKit\"", 438 | "-framework", 439 | "\"SystemConfiguration\"", 440 | "-framework", 441 | "\"UIKit\"", 442 | "-framework", 443 | "\"firebase_auth\"", 444 | "-framework", 445 | "\"firebase_auth_oauth\"", 446 | "-framework", 447 | "\"firebase_core\"", 448 | "-framework", 449 | "\"nanopb\"", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = me.amryousef.apple.auth.firebaseAppleAuthExample; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 454 | SWIFT_VERSION = 5.0; 455 | VERSIONING_SYSTEM = "apple-generic"; 456 | }; 457 | name = Profile; 458 | }; 459 | 97C147031CF9000F007C117D /* Debug */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | ALWAYS_SEARCH_USER_PATHS = NO; 463 | CLANG_ANALYZER_NONNULL = YES; 464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 465 | CLANG_CXX_LIBRARY = "libc++"; 466 | CLANG_ENABLE_MODULES = YES; 467 | CLANG_ENABLE_OBJC_ARC = YES; 468 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_COMMA = YES; 471 | CLANG_WARN_CONSTANT_CONVERSION = YES; 472 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 473 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 474 | CLANG_WARN_EMPTY_BODY = YES; 475 | CLANG_WARN_ENUM_CONVERSION = YES; 476 | CLANG_WARN_INFINITE_RECURSION = YES; 477 | CLANG_WARN_INT_CONVERSION = YES; 478 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 480 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 481 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 482 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 483 | CLANG_WARN_STRICT_PROTOTYPES = YES; 484 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 485 | CLANG_WARN_UNREACHABLE_CODE = YES; 486 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 487 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 488 | COPY_PHASE_STRIP = NO; 489 | DEBUG_INFORMATION_FORMAT = dwarf; 490 | ENABLE_STRICT_OBJC_MSGSEND = YES; 491 | ENABLE_TESTABILITY = YES; 492 | GCC_C_LANGUAGE_STANDARD = gnu99; 493 | GCC_DYNAMIC_NO_PIC = NO; 494 | GCC_NO_COMMON_BLOCKS = YES; 495 | GCC_OPTIMIZATION_LEVEL = 0; 496 | GCC_PREPROCESSOR_DEFINITIONS = ( 497 | "DEBUG=1", 498 | "$(inherited)", 499 | ); 500 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 501 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 502 | GCC_WARN_UNDECLARED_SELECTOR = YES; 503 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 504 | GCC_WARN_UNUSED_FUNCTION = YES; 505 | GCC_WARN_UNUSED_VARIABLE = YES; 506 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 507 | MTL_ENABLE_DEBUG_INFO = YES; 508 | ONLY_ACTIVE_ARCH = YES; 509 | SDKROOT = iphoneos; 510 | TARGETED_DEVICE_FAMILY = "1,2"; 511 | }; 512 | name = Debug; 513 | }; 514 | 97C147041CF9000F007C117D /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | ALWAYS_SEARCH_USER_PATHS = NO; 518 | CLANG_ANALYZER_NONNULL = YES; 519 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 520 | CLANG_CXX_LIBRARY = "libc++"; 521 | CLANG_ENABLE_MODULES = YES; 522 | CLANG_ENABLE_OBJC_ARC = YES; 523 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 524 | CLANG_WARN_BOOL_CONVERSION = YES; 525 | CLANG_WARN_COMMA = YES; 526 | CLANG_WARN_CONSTANT_CONVERSION = YES; 527 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 528 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 529 | CLANG_WARN_EMPTY_BODY = YES; 530 | CLANG_WARN_ENUM_CONVERSION = YES; 531 | CLANG_WARN_INFINITE_RECURSION = YES; 532 | CLANG_WARN_INT_CONVERSION = YES; 533 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 534 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 535 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 536 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 537 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 538 | CLANG_WARN_STRICT_PROTOTYPES = YES; 539 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 540 | CLANG_WARN_UNREACHABLE_CODE = YES; 541 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 542 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 543 | COPY_PHASE_STRIP = NO; 544 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 545 | ENABLE_NS_ASSERTIONS = NO; 546 | ENABLE_STRICT_OBJC_MSGSEND = YES; 547 | GCC_C_LANGUAGE_STANDARD = gnu99; 548 | GCC_NO_COMMON_BLOCKS = YES; 549 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 550 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 551 | GCC_WARN_UNDECLARED_SELECTOR = YES; 552 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 553 | GCC_WARN_UNUSED_FUNCTION = YES; 554 | GCC_WARN_UNUSED_VARIABLE = YES; 555 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 556 | MTL_ENABLE_DEBUG_INFO = NO; 557 | SDKROOT = iphoneos; 558 | SUPPORTED_PLATFORMS = iphoneos; 559 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 560 | TARGETED_DEVICE_FAMILY = "1,2"; 561 | VALIDATE_PRODUCT = YES; 562 | }; 563 | name = Release; 564 | }; 565 | 97C147061CF9000F007C117D /* Debug */ = { 566 | isa = XCBuildConfiguration; 567 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 568 | buildSettings = { 569 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 570 | CLANG_ENABLE_MODULES = YES; 571 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 572 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 573 | DEVELOPMENT_TEAM = P8C49CPC4X; 574 | ENABLE_BITCODE = NO; 575 | FRAMEWORK_SEARCH_PATHS = ( 576 | "$(inherited)", 577 | "$(PROJECT_DIR)/Flutter", 578 | ); 579 | INFOPLIST_FILE = Runner/Info.plist; 580 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 581 | LIBRARY_SEARCH_PATHS = ( 582 | "$(inherited)", 583 | "$(PROJECT_DIR)/Flutter", 584 | ); 585 | OTHER_LDFLAGS = ( 586 | "$(inherited)", 587 | "-framework", 588 | Flutter, 589 | "$(inherited)", 590 | "-ObjC", 591 | "-l\"c++\"", 592 | "-l\"sqlite3\"", 593 | "-l\"z\"", 594 | "-framework", 595 | "\"AuthenticationServices\"", 596 | "-framework", 597 | "\"CryptoKit\"", 598 | "-framework", 599 | "\"FirebaseAuth\"", 600 | "-framework", 601 | "\"FirebaseCore\"", 602 | "-framework", 603 | "\"FirebaseCoreDiagnostics\"", 604 | "-framework", 605 | "\"Flutter\"", 606 | "-framework", 607 | "\"Foundation\"", 608 | "-framework", 609 | "\"GTMSessionFetcher\"", 610 | "-framework", 611 | "\"GoogleDataTransport\"", 612 | "-framework", 613 | "\"SafariServices\"", 614 | "-framework", 615 | "\"Security\"", 616 | "-framework", 617 | "\"StoreKit\"", 618 | "-framework", 619 | "\"SystemConfiguration\"", 620 | "-framework", 621 | "\"UIKit\"", 622 | "-framework", 623 | "\"firebase_auth\"", 624 | "-framework", 625 | "\"firebase_auth_oauth\"", 626 | "-framework", 627 | "\"firebase_core\"", 628 | "-framework", 629 | "\"nanopb\"", 630 | ); 631 | PRODUCT_BUNDLE_IDENTIFIER = me.amryousef.apple.auth.firebaseAppleAuthExample; 632 | PRODUCT_NAME = "$(TARGET_NAME)"; 633 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 634 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 635 | SWIFT_VERSION = 5.0; 636 | VERSIONING_SYSTEM = "apple-generic"; 637 | }; 638 | name = Debug; 639 | }; 640 | 97C147071CF9000F007C117D /* Release */ = { 641 | isa = XCBuildConfiguration; 642 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 643 | buildSettings = { 644 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 645 | CLANG_ENABLE_MODULES = YES; 646 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 647 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 648 | DEVELOPMENT_TEAM = P8C49CPC4X; 649 | ENABLE_BITCODE = NO; 650 | FRAMEWORK_SEARCH_PATHS = ( 651 | "$(inherited)", 652 | "$(PROJECT_DIR)/Flutter", 653 | ); 654 | INFOPLIST_FILE = Runner/Info.plist; 655 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 656 | LIBRARY_SEARCH_PATHS = ( 657 | "$(inherited)", 658 | "$(PROJECT_DIR)/Flutter", 659 | ); 660 | OTHER_LDFLAGS = ( 661 | "$(inherited)", 662 | "-framework", 663 | Flutter, 664 | "$(inherited)", 665 | "-ObjC", 666 | "-l\"c++\"", 667 | "-l\"sqlite3\"", 668 | "-l\"z\"", 669 | "-framework", 670 | "\"AuthenticationServices\"", 671 | "-framework", 672 | "\"CryptoKit\"", 673 | "-framework", 674 | "\"FirebaseAuth\"", 675 | "-framework", 676 | "\"FirebaseCore\"", 677 | "-framework", 678 | "\"FirebaseCoreDiagnostics\"", 679 | "-framework", 680 | "\"Flutter\"", 681 | "-framework", 682 | "\"Foundation\"", 683 | "-framework", 684 | "\"GTMSessionFetcher\"", 685 | "-framework", 686 | "\"GoogleDataTransport\"", 687 | "-framework", 688 | "\"SafariServices\"", 689 | "-framework", 690 | "\"Security\"", 691 | "-framework", 692 | "\"StoreKit\"", 693 | "-framework", 694 | "\"SystemConfiguration\"", 695 | "-framework", 696 | "\"UIKit\"", 697 | "-framework", 698 | "\"firebase_auth\"", 699 | "-framework", 700 | "\"firebase_auth_oauth\"", 701 | "-framework", 702 | "\"firebase_core\"", 703 | "-framework", 704 | "\"nanopb\"", 705 | ); 706 | PRODUCT_BUNDLE_IDENTIFIER = me.amryousef.apple.auth.firebaseAppleAuthExample; 707 | PRODUCT_NAME = "$(TARGET_NAME)"; 708 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 709 | SWIFT_VERSION = 5.0; 710 | VERSIONING_SYSTEM = "apple-generic"; 711 | }; 712 | name = Release; 713 | }; 714 | /* End XCBuildConfiguration section */ 715 | 716 | /* Begin XCConfigurationList section */ 717 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 718 | isa = XCConfigurationList; 719 | buildConfigurations = ( 720 | 97C147031CF9000F007C117D /* Debug */, 721 | 97C147041CF9000F007C117D /* Release */, 722 | 249021D3217E4FDB00AE95B9 /* Profile */, 723 | ); 724 | defaultConfigurationIsVisible = 0; 725 | defaultConfigurationName = Release; 726 | }; 727 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 728 | isa = XCConfigurationList; 729 | buildConfigurations = ( 730 | 97C147061CF9000F007C117D /* Debug */, 731 | 97C147071CF9000F007C117D /* Release */, 732 | 249021D4217E4FDB00AE95B9 /* Profile */, 733 | ); 734 | defaultConfigurationIsVisible = 0; 735 | defaultConfigurationName = Release; 736 | }; 737 | /* End XCConfigurationList section */ 738 | }; 739 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 740 | } 741 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 719377316001-5hritti5v3rkbptof9pg2efk4tialskn.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.719377316001-5hritti5v3rkbptof9pg2efk4tialskn 9 | API_KEY 10 | AIzaSyC53TGkciQUmTO8HBZI04NcA7B5DUAC57E 11 | GCM_SENDER_ID 12 | 719377316001 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | me.amryousef.apple.auth.firebaseAppleAuthExample 17 | PROJECT_ID 18 | testfirestore-fd7e2 19 | STORAGE_BUCKET 20 | testfirestore-fd7e2.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:719377316001:ios:bc643ddee5f0261021d8e0 33 | DATABASE_URL 34 | https://testfirestore-fd7e2.firebaseio.com 35 | 36 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | firebase_apple_auth_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleURLSchemes 29 | 30 | com.googleusercontent.apps.719377316001-5hritti5v3rkbptof9pg2efk4tialskn 31 | 32 | 33 | 34 | UILaunchStoryboardName 35 | LaunchScreen 36 | UIMainStoryboardFile 37 | Main 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationPortraitUpsideDown 48 | UIInterfaceOrientationLandscapeLeft 49 | UIInterfaceOrientationLandscapeRight 50 | 51 | UIViewControllerBasedStatusBarAppearance 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/Runner/Runner.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.applesignin 6 | 7 | Default 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/ios/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:719377316001:ios:bc643ddee5f0261021d8e0", 5 | "FIREBASE_PROJECT_ID": "testfirestore-fd7e2", 6 | "GCM_SENDER_ID": "719377316001" 7 | } -------------------------------------------------------------------------------- /firebase_auth_oauth/example/lib/firebase_options.dart: -------------------------------------------------------------------------------- 1 | // File generated by FlutterFire CLI. 2 | // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members 3 | import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; 4 | import 'package:flutter/foundation.dart' 5 | show defaultTargetPlatform, kIsWeb, TargetPlatform; 6 | 7 | /// Default [FirebaseOptions] for use with your Firebase apps. 8 | /// 9 | /// Example: 10 | /// ```dart 11 | /// import 'firebase_options.dart'; 12 | /// // ... 13 | /// await Firebase.initializeApp( 14 | /// options: DefaultFirebaseOptions.currentPlatform, 15 | /// ); 16 | /// ``` 17 | class DefaultFirebaseOptions { 18 | static FirebaseOptions get currentPlatform { 19 | if (kIsWeb) { 20 | return web; 21 | } 22 | switch (defaultTargetPlatform) { 23 | case TargetPlatform.android: 24 | return android; 25 | case TargetPlatform.iOS: 26 | return ios; 27 | case TargetPlatform.macOS: 28 | throw UnsupportedError( 29 | 'DefaultFirebaseOptions have not been configured for macos - ' 30 | 'you can reconfigure this by running the FlutterFire CLI again.', 31 | ); 32 | case TargetPlatform.windows: 33 | throw UnsupportedError( 34 | 'DefaultFirebaseOptions have not been configured for windows - ' 35 | 'you can reconfigure this by running the FlutterFire CLI again.', 36 | ); 37 | case TargetPlatform.linux: 38 | throw UnsupportedError( 39 | 'DefaultFirebaseOptions have not been configured for linux - ' 40 | 'you can reconfigure this by running the FlutterFire CLI again.', 41 | ); 42 | default: 43 | throw UnsupportedError( 44 | 'DefaultFirebaseOptions are not supported for this platform.', 45 | ); 46 | } 47 | } 48 | 49 | static const FirebaseOptions web = FirebaseOptions( 50 | apiKey: 'AIzaSyDiSdrRegqkVpOAeC9qgjj43e_1jO9PIN0', 51 | appId: '1:719377316001:web:a9d3a2db8fceaa2e21d8e0', 52 | messagingSenderId: '719377316001', 53 | projectId: 'testfirestore-fd7e2', 54 | authDomain: 'testfirestore-fd7e2.firebaseapp.com', 55 | databaseURL: 'https://testfirestore-fd7e2.firebaseio.com', 56 | storageBucket: 'testfirestore-fd7e2.appspot.com', 57 | ); 58 | 59 | static const FirebaseOptions android = FirebaseOptions( 60 | apiKey: 'AIzaSyBFixEmrkbKZKTfU3ebkAzQLj4Xu6Y9B-Q', 61 | appId: '1:719377316001:android:985ce6c58aaa72cd21d8e0', 62 | messagingSenderId: '719377316001', 63 | projectId: 'testfirestore-fd7e2', 64 | databaseURL: 'https://testfirestore-fd7e2.firebaseio.com', 65 | storageBucket: 'testfirestore-fd7e2.appspot.com', 66 | ); 67 | 68 | static const FirebaseOptions ios = FirebaseOptions( 69 | apiKey: 'AIzaSyC53TGkciQUmTO8HBZI04NcA7B5DUAC57E', 70 | appId: '1:719377316001:ios:bc643ddee5f0261021d8e0', 71 | messagingSenderId: '719377316001', 72 | projectId: 'testfirestore-fd7e2', 73 | databaseURL: 'https://testfirestore-fd7e2.firebaseio.com', 74 | storageBucket: 'testfirestore-fd7e2.appspot.com', 75 | androidClientId: '719377316001-0bdvnammejjch8ua3ldsnf6de7lncks9.apps.googleusercontent.com', 76 | iosClientId: '719377316001-5hritti5v3rkbptof9pg2efk4tialskn.apps.googleusercontent.com', 77 | iosBundleId: 'me.amryousef.apple.auth.firebaseAppleAuthExample', 78 | ); 79 | } 80 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'firebase_options.dart'; 3 | import 'package:firebase_auth/firebase_auth.dart'; 4 | import 'package:firebase_auth_oauth/firebase_auth_oauth.dart'; 5 | import 'package:firebase_core/firebase_core.dart'; 6 | import 'package:flutter/material.dart'; 7 | import 'package:flutter/services.dart'; 8 | 9 | void main() async { 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | await Firebase.initializeApp( 12 | options: DefaultFirebaseOptions.currentPlatform, 13 | ); 14 | runApp(MyApp()); 15 | } 16 | 17 | class MyApp extends StatelessWidget { 18 | Future performLogin(String provider, List scopes, 19 | Map parameters) async { 20 | try { 21 | await FirebaseAuthOAuth().openSignInFlow(provider, scopes, parameters); 22 | } on PlatformException catch (error) { 23 | /** 24 | * The plugin has the following error codes: 25 | * 1. FirebaseAuthError: FirebaseAuth related error 26 | * 2. PlatformError: An platform related error 27 | * 3. PluginError: An error from this plugin 28 | */ 29 | debugPrint("${error.code}: ${error.message}"); 30 | } 31 | } 32 | 33 | Future performLink(String provider, List scopes, 34 | Map parameters) async { 35 | try { 36 | await FirebaseAuthOAuth() 37 | .linkExistingUserWithCredentials(provider, scopes, parameters); 38 | } on PlatformException catch (error) { 39 | /** 40 | * The plugin has the following error codes: 41 | * 1. FirebaseAuthError: FirebaseAuth related error 42 | * 2. PlatformError: An platform related error 43 | * 3. PluginError: An error from this plugin 44 | */ 45 | debugPrint("${error.code}: ${error.message}"); 46 | } 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return MaterialApp( 52 | home: Scaffold( 53 | appBar: AppBar( 54 | title: const Text('Plugin example app'), 55 | ), 56 | body: StreamBuilder( 57 | initialData: null, 58 | stream: FirebaseAuth.instance.userChanges(), 59 | builder: (BuildContext context, AsyncSnapshot snapshot) { 60 | return Column( 61 | children: [ 62 | Center( 63 | child: Text( 64 | snapshot.data == null ? "Logged out" : "Logged In"), 65 | ), 66 | if (snapshot.data == null || 67 | snapshot.data?.isAnonymous == true) ...[ 68 | ElevatedButton( 69 | onPressed: () async { 70 | await performLogin( 71 | "apple.com", ["email"], {"locale": "en"}); 72 | }, 73 | child: Text("Sign in By Apple"), 74 | ), 75 | ElevatedButton( 76 | onPressed: () async { 77 | await performLogin( 78 | "twitter.com", ["email"], {"lang": "en"}); 79 | }, 80 | child: Text("Sign in By Twitter"), 81 | ), 82 | ElevatedButton( 83 | onPressed: () async { 84 | await performLogin( 85 | "github.com", ["user:email"], {"lang": "en"}); 86 | }, 87 | child: Text("Sign in By Github"), 88 | ) 89 | ], 90 | if (snapshot.data != null) ...[ 91 | ElevatedButton( 92 | onPressed: () async { 93 | await performLink( 94 | "apple.com", ["email"], {"locale": "en"}); 95 | }, 96 | child: Text("Link Sign in By Apple"), 97 | ), 98 | ElevatedButton( 99 | onPressed: () async { 100 | await performLink( 101 | "twitter.com", ["email"], {"lang": "en"}); 102 | }, 103 | child: Text("Link Sign in By Twitter"), 104 | ), 105 | ElevatedButton( 106 | onPressed: () async { 107 | await performLink( 108 | "github.com", ["user:email"], {"lang": "en"}); 109 | }, 110 | child: Text("Link Sign in By Github"), 111 | ), 112 | ElevatedButton( 113 | onPressed: () async { 114 | await FirebaseAuth.instance.signOut(); 115 | }, 116 | child: Text("Logout"), 117 | ) 118 | ] 119 | ], 120 | ); 121 | })), 122 | ); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: firebase_auth_oauth_example 2 | description: Demonstrates how to use the firebase_auth_oauth plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.12.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | firebase_auth: ^4.1.1 12 | firebase_core: ^2.1.1 13 | 14 | # The following adds the Cupertino Icons font to your application. 15 | # Use with the CupertinoIcons class for iOS style icons. 16 | cupertino_icons: ^0.1.2 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | firebase_auth_oauth: 23 | path: "../" 24 | 25 | flutter: 26 | uses-material-design: true 27 | -------------------------------------------------------------------------------- /firebase_auth_oauth/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | firebase_apple_auth_example 6 | 7 | 8 | 9 | 10 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | /Flutter/flutter_export_environment.sh -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amrfarid140/firebase_auth_oauth/62cfb8487b1e76759a3a2f2fd5905e4dd271b85b/firebase_auth_oauth/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthPlugin+AppleSignIniOS13.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirebaseAuthOAuthPlugin+iOS13.swift 3 | // firebase_auth_oauth 4 | // 5 | // Created by Amr Yousef on 20/06/2020. 6 | // 7 | 8 | import AuthenticationServices 9 | import CryptoKit 10 | import FirebaseAuth 11 | 12 | 13 | extension FirebaseAuthOAuthViewController: ASAuthorizationControllerDelegate { 14 | 15 | @available(iOS 13, *) 16 | func signInWithApple(arguments: [String: String]) { 17 | self.arguments = arguments 18 | self.startSignInWithAppleFlow() 19 | } 20 | 21 | @available(iOS 13, *) 22 | func startSignInWithAppleFlow() { 23 | do { 24 | let nonce = randomNonceString() 25 | let appleIDProvider = ASAuthorizationAppleIDProvider() 26 | let request = appleIDProvider.createRequest() 27 | request.requestedOperation = .operationLogin 28 | if let data = arguments!["scopes"]!.data(using: .utf8) { 29 | if let jsonArray = try JSONSerialization.jsonObject(with: data, options : .allowFragments) as? [String] 30 | { 31 | request.requestedScopes = jsonArray.map({ 32 | (scope) -> ASAuthorization.Scope in 33 | if(scope == "email") {return .email} 34 | else if(scope == "fullName" || scope == "name") {return .fullName} 35 | else {fatalError("Unsupported scope " + scope)} 36 | }) 37 | } else { 38 | print("Invalid scopes list") 39 | } 40 | 41 | } else { 42 | fatalError("Scopes not defined") 43 | } 44 | 45 | request.nonce = sha256(nonce) 46 | currentNonce = nonce 47 | let authorizationController = ASAuthorizationController(authorizationRequests: [request]) 48 | authorizationController.delegate = self 49 | authorizationController.presentationContextProvider = self as? ASAuthorizationControllerPresentationContextProviding 50 | authorizationController.performRequests() 51 | } catch let error as NSError { 52 | fatalError(error.localizedDescription) 53 | } 54 | } 55 | 56 | @available(iOS 13, *) 57 | private func sha256(_ input: String) -> String { 58 | return SHA256.hash(data: Data(input.utf8)).compactMap { 59 | return String(format: "%02x", $0) 60 | }.joined() 61 | } 62 | 63 | // Adapted from https://auth0.com/docs/api-auth/tutorials/nonce#generate-a-cryptographically-random-nonce 64 | private func randomNonceString(length: Int = 32) -> String { 65 | precondition(length > 0) 66 | let charset: Array = 67 | Array("0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._") 68 | var result = "" 69 | var remainingLength = length 70 | 71 | while remainingLength > 0 { 72 | let randoms: [UInt8] = (0 ..< 16).map { _ in 73 | var random: UInt8 = 0 74 | let errorCode = SecRandomCopyBytes(kSecRandomDefault, 1, &random) 75 | if errorCode != errSecSuccess { 76 | finalizeResult( 77 | FirebaseAuthOAuthPluginError.PluginError(error: "Unable to generate nonce. SecRandomCopyBytes failed with OSStatus \(errorCode)") 78 | ) 79 | } 80 | return random 81 | } 82 | 83 | randoms.forEach { random in 84 | if length == 0 { 85 | return 86 | } 87 | 88 | if random < charset.count { 89 | result.append(charset[Int(random)]) 90 | remainingLength -= 1 91 | } 92 | } 93 | } 94 | 95 | return result 96 | } 97 | 98 | @available(iOS 13.0, *) 99 | public func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) { 100 | if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential { 101 | guard let nonce = currentNonce else { 102 | self.finalizeResult( 103 | FirebaseAuthOAuthPluginError 104 | .PluginError(error: "Invalid state: A login callback was received, but no login request was sent.") 105 | ) 106 | return 107 | } 108 | guard let appleIDToken = appleIDCredential.identityToken else { 109 | self.finalizeResult( 110 | FirebaseAuthOAuthPluginError 111 | .PluginError(error: "Invalid appleIDToken") 112 | ) 113 | return 114 | } 115 | guard let idTokenString = String(data: appleIDToken, encoding: .utf8) else { 116 | self.finalizeResult( 117 | FirebaseAuthOAuthPluginError 118 | .PluginError(error: "Invalid appleIDToken") 119 | ) 120 | return 121 | } 122 | let credential = OAuthProvider.credential(withProviderID: "apple.com", 123 | idToken: idTokenString, 124 | rawNonce: nonce) 125 | self.consumeCredentials(credential) 126 | } 127 | } 128 | 129 | @available(iOS 13.0, *) 130 | public func authorizationController(controller: ASAuthorizationController, didCompleteWithError error: Error) { 131 | self.finalizeResult(FirebaseAuthOAuthPluginError.PlatformError(error: error)) 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthPlugin+OAuthSignIn.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirebaseAuthOAuthPlugin+OAuthSignIn.swift 3 | // firebase_auth_oauth 4 | // 5 | // Created by Amr Yousef on 20/06/2020. 6 | // 7 | 8 | import FirebaseAuth 9 | 10 | extension FirebaseAuthOAuthViewController { 11 | func oAuthSignIn(arguments: [String: String]) { 12 | guard let scopesString = arguments["scopes"] else { 13 | finalizeResult( 14 | FirebaseAuthOAuthPluginError 15 | .PluginError(error: "Scope cannot be null") 16 | ) 17 | return 18 | } 19 | 20 | guard let data = scopesString.data(using: .utf8) else { 21 | finalizeResult( 22 | FirebaseAuthOAuthPluginError 23 | .PluginError(error: "Invalid scopes list") 24 | ) 25 | return 26 | } 27 | 28 | guard let jsonArray = try? JSONSerialization.jsonObject(with: data, options : .allowFragments) as? [String] else { 29 | finalizeResult( 30 | FirebaseAuthOAuthPluginError 31 | .PluginError(error: "Invalid scopes list") 32 | ) 33 | return 34 | } 35 | authProvider?.scopes = jsonArray 36 | 37 | let parametersString = arguments["parameters"] 38 | 39 | if let data = parametersString?.data(using: .utf8) { 40 | if let jsonObject = try? JSONSerialization.jsonObject(with: data, options : .allowFragments) as? Dictionary 41 | { 42 | authProvider?.customParameters = jsonObject 43 | } 44 | } 45 | 46 | authProvider?.getCredentialWith(nil) { credential, error in 47 | if let firebaseError = error { 48 | self.finalizeResult( 49 | FirebaseAuthOAuthPluginError 50 | .FirebaseAuthError(error: firebaseError) 51 | ) 52 | return 53 | } 54 | 55 | if credential != nil { 56 | self.consumeCredentials(credential!) 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FirebaseAuthOAuthPlugin : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthPlugin.m: -------------------------------------------------------------------------------- 1 | #import "FirebaseAuthOAuthPlugin.h" 2 | #if __has_include() 3 | #import 4 | #else 5 | // Support project import fallback if the generated compatibility header 6 | // is not copied when this plugin is created as a library. 7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 8 | #import "firebase_auth_oauth-Swift.h" 9 | #endif 10 | 11 | @implementation FirebaseAuthOAuthPlugin 12 | + (void)registerWithRegistrar:(NSObject*)registrar { 13 | [FirebaseAuthOAuthViewController registerWithRegistrar:registrar]; 14 | } 15 | @end 16 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthPluginError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FirebaseAuthOAuthPluginError.swift 3 | // firebase_auth_oauth 4 | // 5 | // Created by Amr Yousef on 20/06/2020. 6 | // 7 | 8 | enum FirebaseAuthOAuthPluginError: Error { 9 | case FirebaseAuthError(error: Error) 10 | case PluginError(error: String) 11 | case PlatformError(error: Error) 12 | 13 | var code: String { 14 | switch self { 15 | case .FirebaseAuthError: 16 | return "FirebaseAuthError" 17 | case .PluginError: 18 | return "PluginError" 19 | case .PlatformError: 20 | return "PlatformError" 21 | } 22 | } 23 | } 24 | 25 | extension FirebaseAuthOAuthPluginError { 26 | func flutterError() -> FlutterError { 27 | switch self { 28 | case .FirebaseAuthError(let error): 29 | return FlutterError(code: code, message: error.localizedDescription, details: nil) 30 | case .PlatformError(let error): 31 | return FlutterError(code: code, message: error.localizedDescription, details: nil) 32 | case .PluginError(let error): 33 | return FlutterError(code: code, message: error, details: nil) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/FirebaseAuthOAuthViewController.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import FirebaseAuth 4 | 5 | public class FirebaseAuthOAuthViewController: UIViewController, FlutterPlugin { 6 | private static let CREATE_USER_METHOD = "signInOAuth" 7 | private static let LINK_USER_METHOD = "linkWithOAuth" 8 | 9 | internal var currentNonce: String? 10 | private var call: FlutterMethodCall? 11 | private var result: FlutterResult? 12 | private(set) public var authProvider: OAuthProvider? 13 | var arguments: [String: String]? 14 | 15 | public static func register(with registrar: FlutterPluginRegistrar) { 16 | let channel = FlutterMethodChannel(name: "me.amryousef.apple.auth/firebase_auth_oauth", binaryMessenger: registrar.messenger()) 17 | let instance = FirebaseAuthOAuthViewController() 18 | registrar.addMethodCallDelegate(instance, channel: channel) 19 | } 20 | 21 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 22 | self.result = result 23 | self.call = call 24 | if let arguments = call.arguments as? [String:String] { 25 | guard let providerId = arguments["provider"] else { 26 | finalizeResult( 27 | FirebaseAuthOAuthPluginError 28 | .PluginError(error: "Provider argument cannot be null") 29 | ) 30 | return 31 | } 32 | if providerId == "apple.com" { 33 | if #available(iOS 13.0, *) { 34 | signInWithApple(arguments: arguments) 35 | } else { 36 | finalizeResult(FirebaseAuthOAuthPluginError.PluginError(error: "Sign in by Apple is not supported for this iOS version")) 37 | } 38 | } else { 39 | authProvider = OAuthProvider(providerID: providerId) 40 | oAuthSignIn(arguments: arguments) 41 | } 42 | } else { 43 | finalizeResult(FirebaseAuthOAuthPluginError.PluginError(error: "call arguments cannot be null")) 44 | } 45 | } 46 | 47 | func consumeCredentials(_ credential: AuthCredential) { 48 | if call?.method == FirebaseAuthOAuthViewController.CREATE_USER_METHOD { 49 | Auth.auth().signIn(with: credential) { authResult, error in 50 | guard let currentUser = Auth.auth().currentUser else { 51 | self.finalizeResult(.PluginError(error: "currentUser is nil. Make sure a user exists when \(FirebaseAuthOAuthViewController.CREATE_USER_METHOD) is used.")) 52 | return 53 | } 54 | if let firebaseError = error { 55 | self.finalizeResult( 56 | FirebaseAuthOAuthPluginError 57 | .FirebaseAuthError(error: firebaseError) 58 | ) 59 | } 60 | self.finalizeResult(authResult, currentUser) 61 | } 62 | } 63 | if call?.method == FirebaseAuthOAuthViewController.LINK_USER_METHOD { 64 | guard let currentUser = Auth.auth().currentUser else { 65 | self.finalizeResult(.PluginError(error: "currentUser is nil. Make sure a user exists when \(FirebaseAuthOAuthViewController.LINK_USER_METHOD) is used.")) 66 | return 67 | } 68 | currentUser.link(with: credential) { (authResult, error) in 69 | if let firebaseError = error { 70 | self.finalizeResult( 71 | FirebaseAuthOAuthPluginError 72 | .FirebaseAuthError(error: firebaseError) 73 | ) 74 | } 75 | if authResult != nil { 76 | self.finalizeResult(authResult, currentUser) 77 | } 78 | } 79 | } 80 | } 81 | 82 | func finalizeResult(_ error: FirebaseAuthOAuthPluginError) { 83 | finalizeResult(authResult: nil, user: nil, error: error) 84 | } 85 | 86 | func finalizeResult(_ user: User) { 87 | finalizeResult(authResult: nil, user: user, error: nil) 88 | } 89 | 90 | func finalizeResult(_ authResult: AuthDataResult?, _ user: User) { 91 | finalizeResult(authResult: authResult, user: user, error: nil) 92 | } 93 | 94 | private func finalizeResult(authResult: AuthDataResult?, user: User?, error: FirebaseAuthOAuthPluginError?) { 95 | if user != nil { 96 | if authResult != nil { 97 | let credential = authResult!.credential 98 | if credential is OAuthCredential { 99 | let oauthCredential = credential as! OAuthCredential? 100 | result?([ 101 | "providerId": authResult?.credential?.provider, 102 | "accessToken": oauthCredential?.accessToken, 103 | "idToken": oauthCredential?.idToken, 104 | "secret": oauthCredential?.secret 105 | ]) 106 | } else { 107 | result?([ 108 | "providerId": authResult?.credential?.provider 109 | ]) 110 | } 111 | } else { 112 | result?(nil) 113 | } 114 | } 115 | 116 | if error != nil { 117 | result?(error?.flutterError()) 118 | } 119 | 120 | self.call = nil 121 | self.result = nil 122 | self.authProvider = nil 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/Classes/PluginResult.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PluginResult.swift 3 | // firebase_auth_oauth 4 | // 5 | // Created by Amr Yousef on 20/06/2020. 6 | // 7 | 8 | enum PluginResult { 9 | case Success(data: Any) 10 | case error(error: FirebaseAuthOAuthPluginError) 11 | } 12 | -------------------------------------------------------------------------------- /firebase_auth_oauth/ios/firebase_auth_oauth.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint firebase_auth_oauth.podspec' to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'firebase_auth_oauth' 7 | s.version = '0.0.1' 8 | s.summary = 'A new flutter plugin project.' 9 | s.description = <<-DESC 10 | A new flutter plugin project. 11 | DESC 12 | s.homepage = 'http://example.com' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Your Company' => 'email@example.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'Flutter' 18 | s.dependency 'firebase_auth' 19 | # s.dependency 'CryptoSwift', '~> 1.2.0' 20 | s.framework = 'AuthenticationServices' 21 | s.framework = 'CryptoKit' 22 | s.static_framework = true 23 | s.platform = :ios, '11.4' 24 | 25 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported. 26 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' } 27 | s.swift_version = '5.0' 28 | end 29 | -------------------------------------------------------------------------------- /firebase_auth_oauth/lib/firebase_auth_oauth.dart: -------------------------------------------------------------------------------- 1 | library firebase_apple_auth; 2 | 3 | import 'package:firebase_auth/firebase_auth.dart'; 4 | import 'package:firebase_auth_oauth_platform_interface/firebase_auth_oauth_platform_interface.dart' 5 | as platform; 6 | import 'package:firebase_core/firebase_core.dart'; 7 | 8 | class FirebaseAuthOAuth implements platform.FirebaseAuthOAuth { 9 | final platform.FirebaseAuthOAuth _delegate; 10 | 11 | FirebaseAuthOAuth({FirebaseApp? app}) 12 | : _delegate = app != null 13 | ? platform.FirebaseAuthOAuth.instance.withApp(app) 14 | : platform.FirebaseAuthOAuth.instance; 15 | 16 | @override 17 | Future openSignInFlow(String provider, List scopes, 18 | [Map? customOAuthParameters]) => 19 | _delegate.openSignInFlow(provider, scopes, customOAuthParameters); 20 | 21 | @override 22 | Future linkExistingUserWithCredentials( 23 | String provider, List scopes, 24 | [Map? customOAuthParameters]) => 25 | _delegate.linkExistingUserWithCredentials( 26 | provider, scopes, customOAuthParameters); 27 | 28 | @override 29 | Future signInOAuth(String provider, List scopes, 30 | [Map? customOAuthParameters]) => 31 | _delegate.signInOAuth(provider, scopes, customOAuthParameters); 32 | 33 | @override 34 | Future linkWithOAuth(String provider, List scopes, 35 | [Map? customOAuthParameters]) => 36 | _delegate.linkWithOAuth(provider, scopes, customOAuthParameters); 37 | 38 | @override 39 | platform.FirebaseAuthOAuth withApp(FirebaseApp app) => 40 | FirebaseAuthOAuth(app: app); 41 | } 42 | -------------------------------------------------------------------------------- /firebase_auth_oauth/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: firebase_auth_oauth 2 | description: A Flutter plugin that makes it easy to perform OAuth sign in flows using FirebaseAuth. It also includes support for Sign in by Apple for Firebase. 3 | version: 1.2.2 4 | homepage: https://github.com/amrfarid140/firebase_auth_oauth/tree/master/firebase_auth_oauth 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=1.20.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | firebase_auth: ^4.1.1 14 | firebase_core: ^2.1.1 15 | firebase_auth_oauth_platform_interface: ^1.0.3 16 | firebase_auth_oauth_web: ^1.1.1 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | 22 | flutter: 23 | plugin: 24 | platforms: 25 | android: 26 | package: me.amryousef.apple.auth.firebase_auth_oauth 27 | pluginClass: FirebaseAuthOAuthPlugin 28 | ios: 29 | pluginClass: FirebaseAuthOAuthPlugin 30 | web: 31 | default_package: firebase_apple_auth_web 32 | 33 | false_secrets: 34 | - /example/android/app/google-services.json 35 | - /example/ios/Runner/GoogleService-Info.plist 36 | - /example/web/index.html 37 | - /example/lib/firebase_options.dart -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.3 2 | * Updated `firebase_auth` to Version ^4.1.1 3 | * Updated `firebase_core` to Version ^2.1.1 4 | 5 | ## 1.0.2 6 | * Added `signInOAuth` and `linkWithOAuth` 7 | * Updated `firebase_auth` to Version ^3.0.1 8 | * Updated `firebase_core` to Version ^1.4.0 9 | 10 | ## 1.0.1 11 | * Updated `firebase_auth` to Version ^2.0.0 12 | * Updated `firebase_core` to Version ^1.3.0 13 | 14 | ## 1.0.0 15 | 16 | * Migrated to null safety 17 | * Updated `firebase_auth` to Version ^1.0.0 18 | * Updated `firebase_core` to Version ^1.0.0 19 | 20 | ## 0.2.2 21 | 22 | * Updated `firebase_auth` to Version ^0.20.0+1 23 | * Updated `firebase_core` to Version ^0.7.0 24 | 25 | ## 0.2.1 26 | 27 | * Fixed Firebase not initialised issue when using this plugin 28 | 29 | ## 0.2.0 30 | 31 | * Migrated to `firebase_auth` ^0.18.0+1 32 | * Migrated to `firebase_auth` ^0.5.0 33 | * Added `linkExistingUserWithCredentials` to link existing user with OAuth credentials 34 | 35 | ## 0.1.0+6 36 | * Internal method channel rename 37 | 38 | ## 0.1.0+5 39 | * Updated firebase_auth to Version ^0.16.1 40 | * Updated firebase_core to Version ^0.4.5 41 | 42 | ## 0.1.0+4 43 | * Updated firebase_auth to Version ^0.16.0 44 | 45 | ## 0.1.0+3 46 | * Downgraded to 0.15.3 47 | 48 | ## 0.1.0+2 49 | * Use firebase version 0.15.4 50 | 51 | ## 0.1.0+1 52 | * Updated firebase version 53 | 54 | ## 0.1.0 55 | * Initial release 56 | -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Amr Yousef 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # firebase_auth_oauth_platform_interface 2 | 3 | API's definition for `firebase_auth_oauth` to guide the implementation across all supported platforms. 4 | 5 | ## Usage 6 | 7 | You shouldn't be using this directly, your project should depend on `firebase_auth_oauth` which will provide you 8 | with the correct implementation according to the platform its running on. -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/lib/firebase_auth_oauth_platform_interface.dart: -------------------------------------------------------------------------------- 1 | library firebase_apple_auth_platform_interface; 2 | 3 | import 'dart:async'; 4 | import 'dart:convert'; 5 | 6 | import 'package:firebase_auth/firebase_auth.dart'; 7 | import 'package:firebase_core/firebase_core.dart'; 8 | import 'package:flutter/services.dart'; 9 | 10 | part 'method_channel_firebase_auth_oauth.dart'; 11 | 12 | /// Platform interface definition of [FirebaseAuthOAuth] 13 | class FirebaseAuthOAuth { 14 | /// Default instance if [FirebaseAuthOAuth] 15 | static FirebaseAuthOAuth instance = MethodChannelFirebaseAuthOAuth._(); 16 | 17 | FirebaseAuthOAuth._(); 18 | 19 | /// Starts a OAuth sign-in flow for [provider] 20 | /// using Firebase. The instance of FirebaseAuth will be from the default Firebase App 21 | /// Unless [withApp] is used to build an instance 22 | Future openSignInFlow(String provider, List scopes, 23 | [Map? customOAuthParameters]) async { 24 | throw UnimplementedError("openSignInFlow() is not implemented"); 25 | } 26 | 27 | /// Starts a OAuth sign-in flow for [provider] 28 | /// using Firebase. The instance of FirebaseAuth will be from the default Firebase App 29 | /// Unless [withApp] is used to build an instance. 30 | /// The credentials will be added to the existing Firebase [User] 31 | /// An error will be throw if there's no Firebase [User] 32 | Future linkExistingUserWithCredentials( 33 | String provider, List scopes, 34 | [Map? customOAuthParameters]) async { 35 | throw UnimplementedError( 36 | "linkExistingUserWithCredentials() is not implemented"); 37 | } 38 | 39 | /// Starts a OAuth sign-in flow for [provider] using Firebase. 40 | /// The instance of FirebaseAuth will be from the default Firebase App 41 | /// Unless [withApp] is used to build an instance 42 | /// It will return authentication result [OAuthCredential]. 43 | /// If supported by Firebase, this will contains the provider access 44 | /// token as [accessToken]. 45 | Future signInOAuth(String provider, List scopes, 46 | [Map? customOAuthParameters]) async { 47 | throw UnimplementedError("signInOAuth() is not implemented"); 48 | } 49 | 50 | /// Starts a OAuth sign-in flow for [provider] using Firebase. 51 | /// The instance of FirebaseAuth will be from the default Firebase App 52 | /// Unless [withApp] is used to build an instance. 53 | /// The credentials will be added to the existing Firebase [User] 54 | /// An error will be throw if there's no Firebase [User] 55 | /// It will return authentication result [OAuthCredential]. 56 | /// If supported by Firebase, this will contains the provider access 57 | /// token as [accessToken]. 58 | Future linkWithOAuth(String provider, List scopes, 59 | [Map? customOAuthParameters]) async { 60 | throw UnimplementedError("linkWithOAuth() is not implemented"); 61 | } 62 | 63 | /// Builds an instance of [FirebaseAuthOAuth] using a [FirebaseApp] instance 64 | FirebaseAuthOAuth withApp(FirebaseApp app) { 65 | throw UnimplementedError("withApp() is not implemented"); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/lib/method_channel_firebase_auth_oauth.dart: -------------------------------------------------------------------------------- 1 | part of firebase_apple_auth_platform_interface; 2 | 3 | /// Method channel implementation of [FirebaseAuthOAuth] 4 | class MethodChannelFirebaseAuthOAuth extends FirebaseAuthOAuth { 5 | FirebaseApp _app; 6 | 7 | static const MethodChannel _channel = 8 | const MethodChannel('me.amryousef.apple.auth/firebase_auth_oauth'); 9 | 10 | MethodChannelFirebaseAuthOAuth._({FirebaseApp? app}) 11 | : _app = app == null ? Firebase.app() : app, 12 | super._(); 13 | 14 | @override 15 | Future openSignInFlow(String provider, List scopes, 16 | [Map? customOAuthParameters]) async { 17 | await _channel.invokeMethod("signInOAuth", { 18 | 'provider': provider, 19 | 'app': _app.name, 20 | 'scopes': json.encode(scopes), 21 | if (customOAuthParameters != null) 22 | 'parameters': json.encode(customOAuthParameters) 23 | }); 24 | return FirebaseAuth.instanceFor(app: _app).currentUser; 25 | } 26 | 27 | @override 28 | Future linkExistingUserWithCredentials( 29 | String provider, List scopes, 30 | [Map? customOAuthParameters]) async { 31 | await _channel.invokeMethod("linkWithOAuth", { 32 | 'provider': provider, 33 | 'app': _app.name, 34 | 'scopes': json.encode(scopes), 35 | if (customOAuthParameters != null) 36 | 'parameters': json.encode(customOAuthParameters) 37 | }); 38 | return FirebaseAuth.instanceFor(app: _app).currentUser; 39 | } 40 | 41 | @override 42 | Future signInOAuth(String provider, List scopes, 43 | [Map? customOAuthParameters]) async { 44 | final data = await _channel.invokeMethod("signInOAuth", { 45 | 'provider': provider, 46 | 'app': _app.name, 47 | 'scopes': json.encode(scopes), 48 | if (customOAuthParameters != null) 49 | 'parameters': json.encode(customOAuthParameters) 50 | }); 51 | return OAuthCredential( 52 | signInMethod: "oauth", 53 | providerId: data?["providerId"] ?? "", 54 | accessToken: data?["accessToken"] ?? "", 55 | idToken: data?["idToken"] ?? "", 56 | secret: data?["secret"] ?? "", 57 | rawNonce: data?["rawNonce"] ?? "", 58 | ); 59 | } 60 | 61 | @override 62 | Future linkWithOAuth(String provider, List scopes, 63 | [Map? customOAuthParameters]) async { 64 | final data = await _channel.invokeMethod("linkWithOAuth", { 65 | 'provider': provider, 66 | 'app': _app.name, 67 | 'scopes': json.encode(scopes), 68 | if (customOAuthParameters != null) 69 | 'parameters': json.encode(customOAuthParameters) 70 | }); 71 | return OAuthCredential( 72 | signInMethod: "oauth", 73 | providerId: data?["providerId"] ?? "", 74 | accessToken: data?["accessToken"] ?? "", 75 | idToken: data?["idToken"] ?? "", 76 | secret: data?["secret"] ?? "", 77 | rawNonce: data?["rawNonce"] ?? "", 78 | ); 79 | } 80 | 81 | @override 82 | FirebaseAuthOAuth withApp(FirebaseApp app) => 83 | MethodChannelFirebaseAuthOAuth._(app: app); 84 | } 85 | -------------------------------------------------------------------------------- /firebase_auth_oauth_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: firebase_auth_oauth_platform_interface 2 | description: Platform interface plugin for firebase_auth_oauth. This includes 3 | API definition which will be implemented for android, ios and web. 4 | version: 1.0.3 5 | homepage: https://github.com/amrfarid140/firebase_auth_oauth/tree/master/firebase_auth_oauth_platform_interface 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | firebase_auth: ^4.1.1 14 | firebase_core: ^2.1.1 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | pedantic: ^1.8.0 20 | -------------------------------------------------------------------------------- /firebase_auth_oauth_web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /firebase_auth_oauth_web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.1 2 | * Updated `firebase_auth` to Version ^4.1.1 3 | * Updated `firebase_core` to Version ^2.1.1 4 | 5 | ## 1.1.0 6 | 7 | * **[Breaking Change]** Update minimum flutter version to `1.20.0` 8 | * Remove unused android and iOS sample code 9 | 10 | ## 1.0.2 11 | 12 | * Added `signInOAuth` and `linkWithOAuth` 13 | * Updated `firebase_auth` to Version ^3.0.1 14 | * Updated `firebase_core` to Version ^1.4.0 15 | 16 | ## 1.0.1 17 | 18 | * Updated `firebase_auth` to Version ^2.0.0 19 | * Updated `firebase_core` to Version ^1.3.0 20 | * Updated `firebase` to Version ^9.0.1 21 | 22 | ## 1.0.0 23 | 24 | * Migrated to null safety 25 | * Updated `firebase_auth` to Version ^1.0.0 26 | * Updated `firebase_core` to Version ^1.0.0 27 | 28 | ## 0.2.2 29 | 30 | * Updated `firebase_auth` to Version ^0.20.0+1 31 | * Updated `firebase_core` to Version ^0.7.0 32 | 33 | ## 0.2.1 34 | 35 | * Fixed Firebase not initialised issue when using this plugin 36 | 37 | ## 0.2.0 38 | 39 | * Migrated to `firebase_auth` ^0.18.0+1 40 | * Migrated to `firebase_auth` ^0.5.0 41 | * Added `linkExistingUserWithCredentials` to link existing user with OAuth credentials 42 | 43 | ## 0.1.0+7 44 | 45 | * Updated firebase_auth to Version ^0.16.1 46 | * Updated firebase_core to Version ^0.4.5 47 | 48 | ## 0.1.0+6 49 | 50 | * Updated firebase_auth to Version ^0.16.0 51 | 52 | ## 0.1.0+5 53 | 54 | * Downgraded Firebase version 0.15.3 55 | 56 | ## 0.1.0+4 57 | 58 | * Use Firebase version 0.15.4 59 | 60 | ## 0.1.0+3 61 | 62 | * Updated Firebase version 63 | 64 | ## 0.1.0+2 65 | 66 | * Removed unnecessary files 67 | 68 | ## 0.1.0+1 69 | 70 | * Fixed builds on iOS (renamed podspec) file 71 | 72 | ## 0.1.0 73 | 74 | * Initial release 75 | -------------------------------------------------------------------------------- /firebase_auth_oauth_web/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Amr Yousef 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /firebase_auth_oauth_web/README.md: -------------------------------------------------------------------------------- 1 | # firebase_auth_oauth_web 2 | 3 | Web implementation for `firebase_auth_oauth` 4 | 5 | ## Usage 6 | 7 | ### Import the package 8 | 9 | To use this plugin in your Flutter app on the web, simply add the base `firebase_auth_oauth` package as a 10 | dependency in your `pubspec.yaml` 11 | 12 | ### Updating `index.html` 13 | 14 | Due to [this bug in dartdevc][2], you will need to manually add the Firebase 15 | JavaScript files to your `index.html` file. 16 | 17 | In your app directory, edit `web/index.html` to add the line: 18 | 19 | ```html 20 | 21 | ... 22 | 23 | 24 | 25 | 26 | 27 | 28 | ``` 29 | -------------------------------------------------------------------------------- /firebase_auth_oauth_web/lib/firebase_auth_oauth_web.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase/firebase.dart' as web; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | import 'package:firebase_auth_oauth_platform_interface/firebase_auth_oauth_platform_interface.dart'; 4 | import 'package:firebase_core/firebase_core.dart'; 5 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 6 | 7 | typedef _AppProvider = FirebaseApp Function(); 8 | 9 | /// Web implementation for [FirebaseAuthOAuth] 10 | class FirebaseAuthOAuthWeb implements FirebaseAuthOAuth { 11 | _AppProvider _app = () => Firebase.app(); 12 | 13 | /// Register this implementation as the default [FirebaseAuthOAuth] instance 14 | /// Shouldn't be used inside a project. It is automatically invoked by Flutter build system. 15 | static void registerWith(Registrar registrar) { 16 | FirebaseAuthOAuth.instance = FirebaseAuthOAuthWeb._(); 17 | } 18 | 19 | FirebaseAuthOAuthWeb._({FirebaseApp? app}) { 20 | if (app != null) { 21 | _app = () => app; 22 | } 23 | } 24 | 25 | @override 26 | Future openSignInFlow(String provider, List scopes, 27 | [Map? customOAuthParameters]) async { 28 | final oAuthProvider = web.OAuthProvider(provider); 29 | scopes.forEach((scope) => oAuthProvider.addScope(scope)); 30 | if (customOAuthParameters != null) { 31 | oAuthProvider.setCustomParameters(customOAuthParameters); 32 | } 33 | await web.app(_app().name).auth().signInWithPopup(oAuthProvider); 34 | return FirebaseAuth.instanceFor(app: _app()).currentUser; 35 | } 36 | 37 | @override 38 | Future linkExistingUserWithCredentials( 39 | String provider, List scopes, 40 | [Map? customOAuthParameters]) async { 41 | final oAuthProvider = web.OAuthProvider(provider); 42 | scopes.forEach((scope) => oAuthProvider.addScope(scope)); 43 | if (customOAuthParameters != null) { 44 | oAuthProvider.setCustomParameters(customOAuthParameters); 45 | } 46 | if (FirebaseAuth.instanceFor(app: _app()).currentUser == null) { 47 | return Future.error(StateError( 48 | "currentUser is nil. Make sure a user exists when linkExistingUserWithCredentials is used")); 49 | } 50 | await web.app(_app().name).auth().currentUser?.linkWithPopup(oAuthProvider); 51 | return FirebaseAuth.instanceFor(app: _app()).currentUser; 52 | } 53 | 54 | @override 55 | Future signInOAuth(String provider, List scopes, 56 | [Map? customOAuthParameters]) async { 57 | final oAuthProvider = web.OAuthProvider(provider); 58 | scopes.forEach((scope) => oAuthProvider.addScope(scope)); 59 | if (customOAuthParameters != null) { 60 | oAuthProvider.setCustomParameters(customOAuthParameters); 61 | } 62 | final result = 63 | await web.app(_app().name).auth().signInWithPopup(oAuthProvider); 64 | 65 | return OAuthCredential( 66 | signInMethod: "oauth", 67 | providerId: result.credential.providerId, 68 | accessToken: result.credential.accessToken, 69 | idToken: result.credential.idToken, 70 | secret: result.credential.secret, 71 | ); 72 | } 73 | 74 | @override 75 | Future linkWithOAuth(String provider, List scopes, 76 | [Map? customOAuthParameters]) async { 77 | final oAuthProvider = web.OAuthProvider(provider); 78 | scopes.forEach((scope) => oAuthProvider.addScope(scope)); 79 | if (customOAuthParameters != null) { 80 | oAuthProvider.setCustomParameters(customOAuthParameters); 81 | } 82 | if (FirebaseAuth.instanceFor(app: _app()).currentUser == null) { 83 | return Future.error(StateError( 84 | "currentUser is nil. Make sure a user exists when linkWithOAuth is used")); 85 | } 86 | final result = await web 87 | .app(_app().name) 88 | .auth() 89 | .currentUser 90 | ?.linkWithPopup(oAuthProvider); 91 | 92 | return OAuthCredential( 93 | signInMethod: "oauth", 94 | providerId: result?.credential.providerId ?? "", 95 | accessToken: result?.credential.accessToken, 96 | idToken: result?.credential.idToken, 97 | secret: result?.credential.secret, 98 | ); 99 | } 100 | 101 | @override 102 | FirebaseAuthOAuth withApp(FirebaseApp app) => 103 | FirebaseAuthOAuthWeb._(app: app); 104 | } 105 | -------------------------------------------------------------------------------- /firebase_auth_oauth_web/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: firebase_auth_oauth_web 2 | description: Web implementation for `firebase_auth_oauth`. Don't use directly. Instead import `firebase_auth_oauth` plugin. 3 | version: 1.1.1 4 | homepage: https://github.com/amrfarid140/firebase_auth_oauth/tree/master/firebase_auth_oauth_web 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=1.20.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_web_plugins: 14 | sdk: flutter 15 | firebase: ^9.0.1 16 | firebase_auth: ^4.1.1 17 | firebase_core: ^2.1.1 18 | firebase_auth_oauth_platform_interface: ^1.0.3 19 | js: ^0.6.4 20 | 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | pedantic: ^1.8.0 25 | 26 | flutter: 27 | plugin: 28 | platforms: 29 | web: 30 | pluginClass: FirebaseAuthOAuthWeb 31 | fileName: firebase_auth_oauth_web.dart 32 | -------------------------------------------------------------------------------- /flutterw: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Flutter start up script for UN*X 6 | ## Version: v1.3.1 7 | ## Date: 2022-11-10 07:11:08 8 | ## 9 | ## Use this flutter wrapper to bundle Flutter within your project to make 10 | ## sure everybody builds with the same version. 11 | ## 12 | ## Read about the install and uninstall process in the README on GitHub 13 | ## https://github.com/passsy/flutter_wrapper 14 | ## 15 | ## Inspired by gradle-wrapper. 16 | ## 17 | ############################################################################## 18 | 19 | echoerr() { echo "$@" 1>&2; } 20 | 21 | # Attempt to set APP_HOME 22 | # Resolve links: $0 may be a link 23 | PRG="$0" 24 | # Need this for relative symlinks. 25 | while [ -h "$PRG" ]; do 26 | ls=$(ls -ld "$PRG") 27 | link=$(expr "$ls" : '.*-> \(.*\)$') 28 | if expr "$link" : '/.*' >/dev/null; then 29 | PRG="$link" 30 | else 31 | PRG=$(dirname "$PRG")"/$link" 32 | fi 33 | done 34 | SAVED="$(pwd)" 35 | cd "$(dirname "$PRG")/" >/dev/null 36 | APP_HOME="$(pwd -P)" 37 | cd "$SAVED" >/dev/null 38 | 39 | FLUTTER_SUBMODULE_NAME='.flutter' 40 | GIT_HOME=$(git -C "${APP_HOME}" rev-parse --show-toplevel) 41 | FLUTTER_DIR="${GIT_HOME}/${FLUTTER_SUBMODULE_NAME}" 42 | 43 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 44 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 45 | cd "$(dirname "$0")" 46 | fi 47 | 48 | # Fix not initialized flutter submodule 49 | if [ ! -f "${FLUTTER_DIR}/bin/flutter" ]; then 50 | echoerr "$FLUTTER_SUBMODULE_NAME submodule not initialized. Initializing..." 51 | git submodule update --init "${FLUTTER_DIR}" 52 | fi 53 | 54 | # Detect detach HEAD and fix it. commands like upgrade expect a valid branch, not a detached HEAD 55 | FLUTTER_SYMBOLIC_REF=$(git -C "${FLUTTER_DIR}" symbolic-ref -q HEAD) 56 | if [ -z "${FLUTTER_SYMBOLIC_REF}" ]; then 57 | FLUTTER_REV=$(git -C "${FLUTTER_DIR}" rev-parse HEAD) 58 | FLUTTER_CHANNEL=$(git -C "${GIT_HOME}" config -f .gitmodules submodule.${FLUTTER_SUBMODULE_NAME}.branch) 59 | 60 | if [ -z "${FLUTTER_CHANNEL}" ]; then 61 | echoerr "Warning: Submodule '$FLUTTER_SUBMODULE_NAME' doesn't point to an official Flutter channel \ 62 | (one of stable|beta|dev|master). './flutterw upgrade' will fail without a channel." 63 | echoerr "Fix this by adding a specific channel with:" 64 | echoerr " - './flutterw channel ' or" 65 | echoerr " - Add 'branch = ' to '$FLUTTER_SUBMODULE_NAME' submodule in .gitmodules" 66 | else 67 | echoerr "Fixing detached HEAD: '$FLUTTER_SUBMODULE_NAME' submodule points to a specific commit $FLUTTER_REV, not channel '$FLUTTER_CHANNEL' (as defined in .gitmodules)." 68 | # Make sure channel is fetched 69 | # Remove old channel branch because it might be moved to an unrelated commit where fast-forward pull isn't possible 70 | git -C "${FLUTTER_DIR}" branch -q -D "${FLUTTER_CHANNEL}" 2> /dev/null || true 71 | git -C "${FLUTTER_DIR}" fetch -q origin 72 | 73 | # bind current HEAD to channel defined in .gitmodules 74 | git -C "${FLUTTER_DIR}" checkout -q -b "${FLUTTER_CHANNEL}" "${FLUTTER_REV}" 75 | git -C "${FLUTTER_DIR}" branch -q -u "origin/${FLUTTER_CHANNEL}" "${FLUTTER_CHANNEL}" 76 | echoerr "Fixed! Migrated to channel '$FLUTTER_CHANNEL' while staying at commit $FLUTTER_REV. './flutterw upgrade' now works without problems!" 77 | git -C "${FLUTTER_DIR}" status -bs 78 | fi 79 | fi 80 | 81 | # Wrapper tasks done, call flutter binary with all args 82 | set -e 83 | "$FLUTTER_DIR/bin/flutter" "$@" 84 | set +e 85 | 86 | # Post flutterw tasks. exit code from /bin/flutterw will be used as final exit 87 | FLUTTER_EXIT_STATUS=$? 88 | if [ ${FLUTTER_EXIT_STATUS} -eq 0 ]; then 89 | 90 | # ./flutterw channel CHANNEL 91 | if echo "$@" | grep -q "channel"; then 92 | if [ -n "$2" ]; then 93 | # make sure .gitmodules is updated as well 94 | CHANNEL=${2} # second arg 95 | git config -f "${GIT_HOME}/.gitmodules" "submodule.${FLUTTER_SUBMODULE_NAME}.branch" "${CHANNEL}" 96 | # makes sure nobody forgets to do commit all changed files 97 | git add "${GIT_HOME}/.gitmodules" 98 | git add "${FLUTTER_DIR}" 99 | fi 100 | fi 101 | 102 | # ./flutterw upgrade 103 | if echo "$@" | grep -q "upgrade"; then 104 | # makes sure nobody forgets to do commit the changed submodule 105 | git add "${FLUTTER_DIR}" 106 | # flutter packages get runs automatically. Stage those changes as well 107 | if [ -f pubspec.lock ]; then 108 | git add pubspec.lock 109 | fi 110 | fi 111 | fi 112 | 113 | exit ${FLUTTER_EXIT_STATUS} 114 | --------------------------------------------------------------------------------