okta-sdk-appauth-android
okta-sdk-appauth-android copied to clipboard
java.lang.IllegalArgumentException: Malformed intent android.app.ActivityThread.performLaunchActivity
Hi everyone ,I am implement Authorization with okta in fragment android
mOktaAppAuth=OktaAppAuth.getInstance(context);
try {
mOktaAppAuth?.init(
activity,
object : OktaAppAuth.OktaAuthListener {
override fun onSuccess() {
activity?.runOnUiThread { startAuth() }
}
override fun onTokenFailure(ex: AuthorizationException) {
}
})
} catch (ex: AuthorizationException) {
}
private fun startAuth() {
if (activity != null) {
val completionIntent = Intent(activity, WaitingActivity::class.java)
val cancelIntent = Intent(activity, LoginActivity::class.java)
completionIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK)
try {
mOktaAppAuth?.login(
activity,
PendingIntent.getActivity(activity, 0, completionIntent, 0),
PendingIntent.getActivity(activity, 0, cancelIntent, 0))
} catch (ex: AuthorizationException) {
}
}
}
And sometime my app is crash with status is Caused by java.lang.IllegalArgumentException Malformed intent net.openid.appauth.AuthorizationManagementResponse.fromIntent (AuthorizationManagementResponse.java:61) com.okta.appauth.android.OktaManagementActivity.onStart (OktaManagementActivity.java:126)| I found function in class AuthorizationManagementResponse write
public static AuthorizationManagementResponse fromIntent(@NonNull Intent dataIntent) {
if (EndSessionResponse.containsEndSessionResoponse(dataIntent)) {
return EndSessionResponse.fromIntent(dataIntent);
} else if (AuthorizationResponse.containEndSessionResoponse(dataIntent)) {
return AuthorizationResponse.fromIntent(dataIntent);
} else {
throw new IllegalArgumentException("Malformed intent");
}
}
Anyone help me fix this issues?thanks
Try changing Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK to FLAG_ACTIVITY_CLEAR_TOP. This repository is not maintained. Please use https://github.com/okta/okta-oidc-android
thank @FeiChen-okta I will try it