Litarvan / OpenAuth

Java Yggdrasil library.
GNU General Public License v3.0
161 stars 30 forks source link

[BUG] Error from loginWithAsyncWebview. #41

Open gab4000 opened 1 year ago

gab4000 commented 1 year ago

Bug

loginWithAsyncWebview return an error I think that the problem comes from my Java version but I can't do otherwise.

Config

Full error

Exception in thread "JavaFX Application Thread" java.lang.UnsatisfiedLinkError: Can't load library: /Users/$USER/Library/Java/JavaVirtualMachines/corretto-1.8.0_312/Contents/Home/jre/lib/libjfxwebkit.dylib
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1820)
    at java.lang.Runtime.load0(Runtime.java:810)
    at java.lang.System.load(System.java:1088)
    at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
    at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
    at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
    at com.sun.webkit.WebPage.lambda$static$0(WebPage.java:133)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.webkit.WebPage.<clinit>(WebPage.java:132)
    at javafx.scene.web.WebEngine.<init>(WebEngine.java:881)
    at javafx.scene.web.WebEngine.<init>(WebEngine.java:868)
    at javafx.scene.web.WebView.<init>(WebView.java:273)
    at fr.litarvan.openauth.microsoft.LoginFrame.init(LoginFrame.java:76)
    at fr.litarvan.openauth.microsoft.LoginFrame.lambda$start$0(LoginFrame.java:66)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)

Source code

private void authenticateMS() {

        MicrosoftAuthenticator authenticator = new MicrosoftAuthenticator();
        authenticator.loginWithAsyncWebview().whenComplete((response, error) -> {

            if (error != null) {
                logger.err(error.getMessage());
                return;
            }

            saver.set("msAccessToken", response.getAccessToken());
            saver.set("msRefreshToken", response.getRefreshToken());
            saver.save();

            ModMCore.getInstance().setAuthInfos(new AuthInfos(response.getProfile().getName(), response.getAccessToken(), response.getProfile().getId()));
            this.logger.info("Bienvenue " + response.getProfile().getName());

            Platform.runLater(() -> panelManager.showPanel(new App()));
        });
    }

Ask me for more source code

theavgeekbee commented 10 months ago

I got a HeadlessException from logging through web view.