Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop in brokered authentication #37

Open
YaMoef opened this issue Feb 13, 2024 · 0 comments
Open

Infinite loop in brokered authentication #37

YaMoef opened this issue Feb 13, 2024 · 0 comments

Comments

@YaMoef
Copy link

YaMoef commented Feb 13, 2024

When logging in using brokered authentication (using Microsoft authenticator) I get an infinite loop. When calling the login function it will open Microsoft authenticator and I can select my account, and it will start loading, but the loading animation of the Authenticator app rapidly appears and disappears. At the same time in Logcat I see a bunch of error being thrown. I believe Authenticator tries to call back to the app but fails to do so. When it stops showing the loading animation it will say on Authenticator it can't log me in and prompts me for my user credentials. At this moment nothing is being thrown anymore in Logcat and this error is present

E  FATAL EXCEPTION: main
                                                                                                    Process: MYBUNDLEID, PID: 25699
                                                                                                    java.lang.RuntimeException: Unable to instantiate application MYBUNDLEID.MainActivity package MYBUNDLEID: java.lang.ClassCastException: MYBUNDLEID.MainActivity cannot be cast to android.app.Application
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1466)
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1395)
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6816)
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2155)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:227)
                                                                                                    	at android.os.Looper.loop(Looper.java:327)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7995)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
                                                                                                    Caused by: java.lang.ClassCastException: MYBUNDLEID.MainActivity cannot be cast to android.app.Application
                                                                                                    	at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:76)
                                                                                                    	at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:52)
                                                                                                    	at android.app.Instrumentation.newApplication(Instrumentation.java:1233)
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1458)
                                                                                                    	at android.app.LoadedApk.makeApplicationInner(LoadedApk.java:1395) 
                                                                                                    	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6816) 
                                                                                                    	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2155) 
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:227) 
                                                                                                    	at android.os.Looper.loop(Looper.java:327) 
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7995) 
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942) 
--------- beginning of kernel

I appended the activity block in the manifest file as per shown on the docs and registered the plugin like so:

package MYBUNDLEID;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import android.os.Bundle;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;
import java.util.ArrayList;
import nl.recognize.msauthplugin.MsAuthPlugin;
public class MainActivity extends BridgeActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        registerPlugin(MsAuthPlugin.class);
        super.onCreate(savedInstanceState);
    }
}

Thanks in advance!

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

No branches or pull requests

1 participant