Hello, I’ve tried the Okta Mobile SDK sample in an Android project written in Kotlin which works great.
Now I’m trying to integrate the SDK into an existing Android project (written in Java), but when I try to login using the redirect model, it kept throwing an error saying “RedirectListener has not been initialized.”, which I assume is from here:
webAuthenticationProvider = null
if (localWebAuthenticationProvider != null) {
val exception = localWebAuthenticationProvider.launch(context, url)
if (exception == null) {
return true
} else {
emitError(exception)
}
} else {
emitError(IllegalStateException("RedirectListener has not been initialized."))
}
return false
}
override fun emitError(exception: Exception) {
val result = RedirectResult.Error(exception)
val localContinuation = redirectContinuation
reset()
localContinuation?.resume(result)
}
That means the webAuthenticationProvider
is null, but I have no idea why… The webAuthenticationProvider
should be the DefaultWebAuthenticationProvider
when the WebAuthenticationClient
is created from here?
}
/**
* Initializes a web authentication client using the [OidcClient].
*
* @receiver the [OidcClient] used to perform the low level OIDC requests, as well as with which to use the configuration from.
* @param webAuthenticationProvider the [WebAuthenticationProvider] which will be used to show the UI when performing the
* redirect flows.
*/
fun OidcClient.createWebAuthenticationClient(
webAuthenticationProvider: WebAuthenticationProvider = DefaultWebAuthenticationProvider(configuration.eventCoordinator)
): WebAuthenticationClient {
return WebAuthenticationClient(this, webAuthenticationProvider)
}
}
private val authorizationCodeFlow: AuthorizationCodeFlow = oidcClient.createAuthorizationCodeFlow()
private val redirectEndSessionFlow: RedirectEndSessionFlow = oidcClient.createRedirectEndSessionFlow()
@VisibleForTesting internal var redirectCoordinator: RedirectCoordinator = SingletonRedirectCoordinator
Am I supposed to use this SDK in an Android Java Project? Or do I have to use okta-oidc-android
instead?
Thanks
erik
October 10, 2022, 10:47pm
2
Hello,
This SDK was not intended to be used in Android Java projects.
opened 01:28AM - 07 Oct 22 UTC
closed 02:04AM - 07 Oct 22 UTC
enhancement
### Describe the feature request?
Can we add the [@JvmOverloads](https://kotlin… lang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-overloads/index.html) annotation to functions with default parameter values to make it easier to be used by Java? (Unless this SDK is not supposed to be used by an Android project written in Java)
### New or Affected Resource(s)
Functions with default parameters
### Provide a documentation link
_No response_
### Additional Information?
_No response_
system
Closed
February 12, 2024, 10:12pm
3
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.