Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

java.lang.IllegalArgumentException: Malformed intent android.app.ActivityThread.performLaunchActivity #104

Open
robinthuan opened this issue Sep 25, 2019 · 2 comments

Comments

@robinthuan
Copy link

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

@FeiChen-okta
Copy link
Contributor

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

@robinthuan
Copy link
Author

thank @FeiChen-okta I will try it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants