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

User Authentication: Unable to login on Android - No static method addCallback #41

Open
nmandyam opened this issue Apr 9, 2021 · 1 comment

Comments

@nmandyam
Copy link

nmandyam commented Apr 9, 2021

I'm using this plugin to authenticate my Android app with Azure AD. I have set up an app on the Azure side, as needed. On login, though, I'm getting this error:
Error Logging in! Error: java.lang.NoSuchMethodError: No static method addCallback(Lcom/google/common/util/concurrent/ListenableFuture;Lcom/google/common/util/concurrent/FutureCallback;)V in class Lcom/google/common/util/concurrent/Futures; or its super classes (declaration of 'com.google.common.util.concurrent.Futures' appears in /data/app/<app info>==/base.apk)

In terms of behaviour: when I click the button that should send me to Azure AD Auth, a pop-up comes up with nothing on it, then disappears.

As background: I have been unable to add the ALLOWED EXTERNAL REDIRECT URLS, since I can't find that specific setting in my Azure AD portal. The screen-shot that the README.md links to just does not exist in my login. There IS a way to add a Redirect URL for an Android app, but that URL is generated automatically by the portal (App name > Authentication > Android > Add URI). There, I add my package name and it generates a signature hash and a URL of the format msauth://<package-name>/<encoded signature hash>.

My code looks somewhat like this:

        var client = new MobileServiceClient("https://login.microsoftonline.com/<tenant ID>");
	var redirect_val_1 = "<package name>://easyauth.callback";
        var redirect_val_2 = "msauth://<my package name>/<the encoded signature hash>";
	client.login(AuthenticationProvider.Google, redirect_val_1)
	.then((user) => {
            console.log(`Logged In! UserID: ${user.userId}`);
            user.getProviderCredentials().then((result) => {
                console.log(`Surname: ${result.surname}`);
                console.log(`Given Name: ${result.givenName}`);
                console.log(`Name: ${result.name}`);
            });
        }, (e) => {
            console.log("Error Logging in!", e);
        });

I have tried this with both formats of the redirect URLs, as implied above (with the msauth and the easyauth options) and both cause the same error.

I have tried the proplugins version of this plugin, too, and that gives me a whole different error (Error Logging in! Error: java.lang.ClassCastException: com.tns.NativeScriptApplication cannot be cast to android.app.Activity). I don't know where to report that error and look for help.

I am using Nativescript 7.2.1, tns-android 6.5.3.

What am I doing wrong?

@PeterStaev
Copy link
Owner

@nmandyam , you should be using the ProPlugins version for sure. You can log issues in the ProPlugins git for the plugin: https://git.proplugins.org/Tangra/nativescript-azure-mobile-apps/-/issues the login is the same as the one you use to access the ProPlugins NPM.

I've just pushed version 4.0.1 that should resolve that class cast exception you were getting. Please try it and let me know.

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

2 participants