Skip to content

Releases: mirzemehdi/KMPAuth

v2.5.0-alpha01

02 Jan 00:52

Choose a tag to compare

What's Changed

  • Introduce dedicated Facebook auth modules (kmpauth-firebase-facebook and kmpauth-facebook) by @mirzemehdi in #163
  • Upgrade dependencies and add iosX64 target by @mirzemehdi in #164
  • Fix(google-jvm): Use dynamically found port for redirect URI by @mirzemehdi in #165

⚠️ Breaking Change — Facebook Login Removed from kmpauth-firebase

Facebook login support is no longer bundled inside kmpauth-firebase.

If you want to continue using Facebook authentication with Firebase, you must now add the following dependency:

implementation("io.github.mirzemehdi:kmpauth-firebase-facebook:<version>")
  • kmpauth-facebook: This new module encapsulates the platform-specific logic for handling Facebook login. It returns a FacebookUser object containing the access token and nonce upon a successful login, but it does not perform any Firebase authentication itself.
  • kmpauth-firebase-facebook: This module depends on kmpauth-facebook and kmpauth-firebase. It uses the token from kmpauth-facebook to authenticate the user with Firebase. The composable is renamed to FacebookButtonUiContainerFirebase for clarity.

This separation improves modularity by decoupling the core Facebook sign-in flow from the Firebase implementation, allowing for more flexible use of the authentication providers. Dependencies in kmpauth-firebase have been updated accordingly.

Additionally, this change:

  • Adds the iosX64 target to kmpauth-firebase
  • Migrates from compose.material to compose.material3 in kmpauth-firebase and sampleApp.

Full Changelog: v2.4.0-alpha05...v2.5.0-alpha01

v2.4.0-alpha05

30 Aug 16:51

Choose a tag to compare

What's Changed

Full Changelog: v2.4.0-alpha04...v2.4.0-alpha05

v2.4.0-alpha04

29 Aug 13:05

Choose a tag to compare

DON'T USE THIS VERSION. USE 2.4.0-alpha05 INSTEAD

Please use 2.4.0-alpha05 version instead, in 2.4.0-alpha04 android sources are not published correctly

What's Changed

New Contributors

Full Changelog: v2.4.0-alpha03...v2.4.0-alpha04

v2.4.0-alpha03

03 Aug 18:15

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.4.0-alpha02...v2.4.0-alpha03

Facebook Auth Support

This release adds support for Facebook Login with Firebase authentication in Android and iOS using KMPAuth.

Usage Example

//Facebook button with icon
FacebookButtonUiContainer(
    onResult = { result -> /* handle FirebaseUser result or error */ },
    linkAccount = false
) {
    FacebookSignInButtonIconOnly(onClick = { this.onClick() })
}

//Icon Only Button
FacebookButtonUiContainer(
    modifier = Modifier.fillMaxWidth().height(44.dp),
    onResult = { result -> /* handle result */ },
    linkAccount = false
) {
    FacebookSignInButton(fontSize = 19.sp) { this.onClick() }
}

//Custom Button
FacebookButtonUiContainer(
    modifier = Modifier.fillMaxWidth().height(44.dp),
    onResult = { result -> /* handle result */ },
    linkAccount = false
) {
    //Your custom Button here
    YourCustomButton(fontSize = 19.sp) { this.onClick() }
}

Android Setup

Add these to your res/values/strings.xml:

<string name="facebook_app_id">YOUR_FACEBOOK_APP_ID</string>
<string name="fb_login_protocol_scheme">fbYOUR_FACEBOOK_APP_ID</string>
<string name="facebook_client_token">YOUR_FACEBOOK_CLIENT_TOKEN</string>

Add these metadata tags and Facebook Activity to your AndroidManifest.xml inside the <application> tag:

<meta-data
    android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id" />

<meta-data
    android:name="com.facebook.sdk.ClientToken"
    android:value="@string/facebook_client_token" />

<activity
    android:name="com.facebook.FacebookActivity"
    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name" />

For Facebook Login, on Your Main Activity's activity result call KMPAuth.handleFacebookActivityResult function:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    KMPAuth.handleFacebookActivityResult(requestCode, resultCode, data)
    super.onActivityResult(requestCode, resultCode, data)
}

IOS Setup

Add Facebook Login SDK Swift Package, and add below to your Info.plist:

<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fbFACEBOOK_APP_ID</string> <!-- Your Facebook App ID with 'fb' prefix -->
    </array>
  </dict>
</array>

<key>FacebookAppID</key>
<string>FACEBOOK_APP_ID</string>

<key>FacebookClientToken</key>
<string>YOUR_FACEBOOK_CLIENT_TOKEN</string>

<key>FacebookDisplayName</key>
<string>YourAppDisplayName</string>

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>

Initialize Facebook SDK on Ios Swift side

func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
        FirebaseApp.configure()
        // Initialize Facebook SDK. 
        FBSDKCoreKit.ApplicationDelegate.shared.application(
            application,
            didFinishLaunchingWithOptions: launchOptions
        )
        return true
    }

func application(
    _ app: UIApplication,
    open url: URL,
    options: [UIApplication.OpenURLOptionsKey : Any] = [:]
) -> Bool {
    
    var handled: Bool
    handled = FBSDKCoreKit.ApplicationDelegate.shared.application(
        app,
        open: url,
        options: options
    )

    if handled {
        return true
    }
    
    return false
}

Notes

v2.4.0-alpha02

30 May 03:16
c07c916

Choose a tag to compare

What's Changed

Full Changelog: v2.4.0-alpha01...v2.4.0-alpha02

v2.4.0-alpha01

09 May 23:45

Choose a tag to compare

v2.4.0-alpha01 Pre-release
Pre-release

What's Changed

Full Changelog: v2.3.1...v2.4.0-alpha01

v2.3.1

18 Jan 12:24

Choose a tag to compare

What's Changed

  • Adding scopes into GoogleButtonUiContainer and GoogleButtonUiCOntainerFirebase by @mirzemehdi in 65ab3e5

Full Changelog: v2.3.0...v2.3.1

v2.3.0

16 Jan 02:16

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v2.2.0...v2.3.0

v2.3.0-beta03

15 Jan 16:33

Choose a tag to compare

What's Changed

Full Changelog: v2.3.0-beta02...v2.3.0-beta03

v2.3.0-beta02

04 Jan 01:23

Choose a tag to compare

What's Changed

  • Add filterByAuthorizedAccounts parameters to GoogleButtonUiContainer by @lopspower in #70

New Contributors

Full Changelog: v2.3.0-beta01...v2.3.0-beta02