
Plug-and-play sign-in buttons for Google, Apple and Microsoft, offering unified result handling, simple configuration, configurable redirect handlers, and typed sign-in result models for easy integration.
A plug-and-play Compose Multiplatform library for Google, Apple, and Microsoft Sign-In across Android, iOS, and Web(JS/WasmJs).
Add the dependency to your common module's build.gradle.kts:
implementation("com.hyperether.auth:library:<version>")Call the config setup once in your App.kt or app entry point:
GoogleSignInConfigHolder.configure(
config = GoogleSignInConfig(
webClientId = "your_web_client_id.googleusercontent.com",
iosClientId = "your_ios_client_id.apps.googleusercontent.com",
redirectUri = "https://your.domain.com/google-callback",
)
)redirectUri make sure the domain and redirect URI are registered
in Google Cloud Console
AppleSignInConfigHolder.configure(
config = AppleSignInConfig(
iosServiceId = "your.domain.com",
redirectUri = "https://your.domain.com/apple-callback"
)
)redirectUri make sure the domain and redirect URI are registered
in Apple Developer Console > Identifiers > Services
MicrosoftSignInConfigHolder.configure(
config = MicrosoftSignInConfig(
clientId = "your_microsoft_client_id",
redirectUri = "https://your.domain.com/"
)
)redirectUri make sure the domain and redirect URI are registered
in Microsoft Azure
Inside your Compose UI, simply add the buttons:
GoogleButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Google Signed in: $user") },
onFailure = { error -> println("Google Sign-In failed: ${error.message}") }
)
}
)
AppleButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Apple Signed in: $user") },
onFailure = { error -> println("Apple Sign-In failed: ${error.message}") }
)
}
)
MicrosoftButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Microsoft Signed in: $user") },
onFailure = { error -> println("Microsoft Sign-In failed: ${error.message}") }
)
}
)In your MainActivity.kt, forward the redirect:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
AppleSignInResultHandler.handleRedirect(intent)
}In your iosApp.entitlements:
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>In main.kt, call:
AppleSignInResultHandler.handleRedirect()Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.YOUR_IOS_CLIENT_ID</string>
</array>
</dict>
</array>AppDelegate.swift
import GoogleSignIn
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}Podfile
pod 'GoogleSignIn'In main.kt, call:
GoogleSignInResultHandler.handleRedirect()After registering your app, go to Manage > Authentication. On select "Add platform" and create:
Singe-page application
-Register your web Redirect URI
Mobile and desktop applications
-Select MSAL Redirect URI
Update your AndroidManifest.xml:
<activity android:name="com.microsoft.identity.client.BrowserTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msalYOUR_CLIENT_ID" android:host="auth" />
</intent-filter>
</activity>Add this to index.html:
<script src="https://alcdn.msauth.net/browser/2.19.0/js/msal-browser.min.js"></script>Not implemented
Each sign-in button returns a Result<T> specific to the provider:
Result<AppleSignInResult>
Result<GoogleSignInResult>
Result<MicrosoftSignInResult>data class AppleSignInResult(
val idToken: String,
val authCode: String? = null,
val userId: String? = null,
val email: String? = null,
val fullName: FullName? = null,
val platform: Platform
)data class GoogleSignInResult(
val idToken: String,
val userId: String? = null,
val email: String? = null,
val fullName: String? = null,
val platform: Platform
)data class MicrosoftSignInResult(
val token: String? = null,
val accessToken: String? = null,
val email: String? = null,
val tenantId: String? = null,
val platform: Platform
)result.fold(
onSuccess = { user -> /* use the sign-in result */ },
onFailure = { error -> /* handle the error */ }
)Need help integrating or configuring? Feel free to open an issue or contact the maintainers.
A plug-and-play Compose Multiplatform library for Google, Apple, and Microsoft Sign-In across Android, iOS, and Web(JS/WasmJs).
Add the dependency to your common module's build.gradle.kts:
implementation("com.hyperether.auth:library:<version>")Call the config setup once in your App.kt or app entry point:
GoogleSignInConfigHolder.configure(
config = GoogleSignInConfig(
webClientId = "your_web_client_id.googleusercontent.com",
iosClientId = "your_ios_client_id.apps.googleusercontent.com",
redirectUri = "https://your.domain.com/google-callback",
)
)redirectUri make sure the domain and redirect URI are registered
in Google Cloud Console
AppleSignInConfigHolder.configure(
config = AppleSignInConfig(
iosServiceId = "your.domain.com",
redirectUri = "https://your.domain.com/apple-callback"
)
)redirectUri make sure the domain and redirect URI are registered
in Apple Developer Console > Identifiers > Services
MicrosoftSignInConfigHolder.configure(
config = MicrosoftSignInConfig(
clientId = "your_microsoft_client_id",
redirectUri = "https://your.domain.com/"
)
)redirectUri make sure the domain and redirect URI are registered
in Microsoft Azure
Inside your Compose UI, simply add the buttons:
GoogleButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Google Signed in: $user") },
onFailure = { error -> println("Google Sign-In failed: ${error.message}") }
)
}
)
AppleButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Apple Signed in: $user") },
onFailure = { error -> println("Apple Sign-In failed: ${error.message}") }
)
}
)
MicrosoftButtonContainer(
modifier = Modifier.height(44.dp),
onResult = { result ->
result.fold(
onSuccess = { user -> println("Microsoft Signed in: $user") },
onFailure = { error -> println("Microsoft Sign-In failed: ${error.message}") }
)
}
)In your MainActivity.kt, forward the redirect:
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
AppleSignInResultHandler.handleRedirect(intent)
}In your iosApp.entitlements:
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>In main.kt, call:
AppleSignInResultHandler.handleRedirect()Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.YOUR_IOS_CLIENT_ID</string>
</array>
</dict>
</array>AppDelegate.swift
import GoogleSignIn
func application(_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}Podfile
pod 'GoogleSignIn'In main.kt, call:
GoogleSignInResultHandler.handleRedirect()After registering your app, go to Manage > Authentication. On select "Add platform" and create:
Singe-page application
-Register your web Redirect URI
Mobile and desktop applications
-Select MSAL Redirect URI
Update your AndroidManifest.xml:
<activity android:name="com.microsoft.identity.client.BrowserTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="msalYOUR_CLIENT_ID" android:host="auth" />
</intent-filter>
</activity>Add this to index.html:
<script src="https://alcdn.msauth.net/browser/2.19.0/js/msal-browser.min.js"></script>Not implemented
Each sign-in button returns a Result<T> specific to the provider:
Result<AppleSignInResult>
Result<GoogleSignInResult>
Result<MicrosoftSignInResult>data class AppleSignInResult(
val idToken: String,
val authCode: String? = null,
val userId: String? = null,
val email: String? = null,
val fullName: FullName? = null,
val platform: Platform
)data class GoogleSignInResult(
val idToken: String,
val userId: String? = null,
val email: String? = null,
val fullName: String? = null,
val platform: Platform
)data class MicrosoftSignInResult(
val token: String? = null,
val accessToken: String? = null,
val email: String? = null,
val tenantId: String? = null,
val platform: Platform
)result.fold(
onSuccess = { user -> /* use the sign-in result */ },
onFailure = { error -> /* handle the error */ }
)Need help integrating or configuring? Feel free to open an issue or contact the maintainers.