Logout bug in android API using kotlin

I think there is a bug in the logout callback, when using it with Kotlin.

The error is:

Caused by: java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull, parameter payload
        [...]
        at com.auth0.android.provider.LogoutManager.resume(LogoutManager.java:55)
        at com.auth0.android.provider.WebAuthProvider.resume(WebAuthProvider.java:531)
        at com.auth0.android.provider.AuthenticationActivity.deliverAuthenticationResult(AuthenticationActivity.java:129)
        at com.auth0.android.provider.AuthenticationActivity.onResume(AuthenticationActivity.java:90)
        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1446)
        at android.app.Activity.performResume(Activity.java:7939)

It looks like the error is that LogoutManager.resume(LogoutManager.java:55) is called like this
callback.onSuccess(null); but the BaseCallback.void onSuccess(T payload); is specified as non null.

Hey there @ambimi-bpappin!

Can you raise that as a GitHub issue and then share the link to it with us here so we can ping repo maintainers about that? Thanks!

Good afternoon,

One of our sdk engineers suggested on an issue on github(Logout crash · Issue #284 · auth0/Auth0.Android · GitHub) the following:

The stack trace points to this line in the LogoutManager class, which is calling the callback’s onSuccess with null because you were just logged out successfully (and there’s nothing to pass you down the callback). I guess the Void type in Kotlin expects it to have a value other than null, or else it would have been marked as optional in the interface declaration. Is that something you can do or it doesn’t let you? I’d try:

  • Use Void? instead on the VoidCallback implementation
  • Use Unit , which is the Void for Kotlin.

I would recommend trying to implement this.

Thanks!

1 Like

Thanks for the headsup Karen!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.