
Implements OAuth PKCE flow for Android and iOS, facilitating secure authentication by managing URL schemes, OAuth clients, and handling sign-in callbacks across both platforms.
A Kotlin Multiplatform library for Android and iOS that provides an OAuth PKCE flow implementation.
In general, the key steps for using this library are:
exampleapp://)client_id values.PKCEFlow.authState to be notified when the sign in process completes.startSignIn
onNewIntent and handle the auth callback. Something like:override fun onNewIntent(intent: Intent) {
// Ensure the callbackUrl is for OAuth before processing it as such.
if (intent.data?.toString()?.startsWith(PKCE_REDIRECT_URL) == true) {
pkceFlow.continueSignInWithCallbackOrError(dataUrl, null)
}
}AuthenticationServices.authState.state is FINISHED, either extract/save the tokens and proceed with sign-in, or present the user with an error message. See, e.g. https://github.com/collectiveidea/oauth-kmp/blob/main/oauth-core/src/commonTest/kotlin/com/collectiveidea/oauth/PKCEFlowTest.kt#L186
A Kotlin Multiplatform library for Android and iOS that provides an OAuth PKCE flow implementation.
In general, the key steps for using this library are:
exampleapp://)client_id values.PKCEFlow.authState to be notified when the sign in process completes.startSignIn
onNewIntent and handle the auth callback. Something like:override fun onNewIntent(intent: Intent) {
// Ensure the callbackUrl is for OAuth before processing it as such.
if (intent.data?.toString()?.startsWith(PKCE_REDIRECT_URL) == true) {
pkceFlow.continueSignInWithCallbackOrError(dataUrl, null)
}
}AuthenticationServices.authState.state is FINISHED, either extract/save the tokens and proceed with sign-in, or present the user with an error message. See, e.g. https://github.com/collectiveidea/oauth-kmp/blob/main/oauth-core/src/commonTest/kotlin/com/collectiveidea/oauth/PKCEFlowTest.kt#L186