├── .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