Skip to content

Supabase and Apple auth integration#9

Merged
sunildhiman90 merged 11 commits into
mainfrom
supabase_and_apple_auth_integration
Sep 14, 2025
Merged

Supabase and Apple auth integration#9
sunildhiman90 merged 11 commits into
mainfrom
supabase_and_apple_auth_integration

Conversation

@sunildhiman90

Copy link
Copy Markdown
Owner

Supabase and Apple authentication integration

This commit introduces Supabase authentication to the kmauth library.

Key changes include:
- Added a new `kmauth-supabase` module.
- Added a new `kmauth-supabase` module.
- Implemented `SupabaseAuthManager` for handling Supabase authentication logic, including sign-in, sign-out, and user/session retrieval.
- Introduced `SupabaseUser` data class to represent user information from Supabase.
- Updated `KMAuthConfig` in `kmauth-core` to support Supabase-specific configurations (URL and key) and deprecated KMAuthInitializer old methods over KMAuthInitializer.initialize(config: KMAuthConfig)
- Added `KMAuthSupabase` object as an entry point for initializing and accessing Supabase authentication features.
- Included necessary Supabase dependencies in `build.gradle.kts` and updated `libs.versions.toml`.
- Refactored `KMAuthInitializer` in `kmauth-core` to use the new `KMAuthConfig` for a unified configuration approach, while maintaining backward compatibility with deprecated methods.
This commit introduces the following changes:

- Adds `SupabaseOAuthProvider` enum to represent available OAuth providers for Supabase authentication.
- Introduces `SupabaseExternalAuthConfig` and `SupabaseExternalAuthConfigDefaults` to manage external authentication configurations for Supabase.
- Updates `SupabaseAuthManager` and `KMAuthSupabase` to use the new `SupabaseOAuthProvider` and `SupabaseExternalAuthConfig`.
- Removes the `kotlinCocoapods` plugin from `kmauth-supabase/build.gradle.kts`.
- Adds `kmauth-supabase` dependency to `sample/composeApp/build.gradle.kts`.
- Updates the version in `kmauth-google/kmauth_google.podspec`.
This commit introduces several enhancements to the Supabase integration in kmauth:

- **Deep Link Handling:**
    - Added `DeepLinkHandler` (expect/actual) for platform-specific deep link processing.
    - Implemented Android deep link handling in `DeepLinkHandler.android.kt` to use `KMAuthSupabase.getSupabaseClient().handleDeeplinks(intent)`.
    - Added stub implementations for iOS, WasmJs, JS, and JVM.
    - Added `androidDeepLinkHost` and `androidDeepLinkScheme` to `KMAuthConfig` for Supabase deep link configuration.
- **Session Management & User State:**
    - `KMAuthSupabase` now observes Supabase session status and exposes the current `SupabaseUser` as a `StateFlow`.
    - Added `startCollectingSessionStatus()` in `KMAuthSupabase` to listen for authentication changes.
    - Added `toSupabaseUser()` extension function to convert `io.github.jan.supabase.auth.user.UserInfo` to `SupabaseUser`.
- **Refinements & Fixes:**
    - `SupabaseAuthManager` now uses the globally initialized `SupabaseClient` from `KMAuthSupabase` instead of creating its own.
    - Removed `onSignResult` callback from `SupabaseAuthManager.signIn` methods; user state should be observed via `KMAuthSupabase.supabaseUser`.
    - Made `supabase-auth` an `api` dependency in `kmauth-supabase/build.gradle.kts`.
    - Deprecated `KMAuthInitializer.initContext` in favor of `initialize(KMAuthConfig)`.
    - Updated sample app to reflect new Supabase initialization and sign-in flow.
    - Updated `kmauth-google.podspec` version to `0.3.0`.
    - Added GoogleSignIn and GoogleSignInSwift package dependencies to the iOS sample project.
    - Minor reordering of fields in `KMAuthConfig`.
…PLus add google signin package in sample iosApp
… integration, update README and dependencies
@sunildhiman90 sunildhiman90 merged commit 4ba29c0 into main Sep 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant