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

NullPointerException #33

Open
cljung opened this issue Apr 9, 2020 · 1 comment
Open

NullPointerException #33

cljung opened this issue Apr 9, 2020 · 1 comment

Comments

@cljung
Copy link

cljung commented Apr 9, 2020

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

git clone project, load in Android Studio, update B2CConfiguration.java (Custom Policy), build/run the app in Android Studio, select B2C, run flow

Any log messages given by the failure

2020-04-09 15:03:25.392 9962-9962/com.azuresamples.msalandroidapp D/B2CModeFragment: Authentication failed: com.microsoft.identity.client.exception.MsalClientException: Attempt to invoke virtual method 'long java.lang.Long.longValue()' on a null object reference

This is the same issue as observed in another MSAL sample Azure-Samples/ms-identity-android-native#15

Expected/desired behavior

MSAL auth to work.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Win10

Versions

10.0.18362.720

Mention any other details that might be useful

Android Studio 3.6.2


Thanks! We'll be in touch soon.

@marcelmedina
Copy link

marcelmedina commented May 25, 2020

I had the same issue when attempting to login on B2C.

In my case I decided to register my Own Application.

What was missing for me was the read scope.

You need to expose an API
image

and then assign the permission and grant admin consent:
image

On B2CConfiguration.java update the URL:

/**
     * Returns an array of scopes you wish to acquire as part of the returned token result.
     * These scopes must be added in your B2C application page.
     */
    public static List<String> getScopes() {
        return Arrays.asList(
                "https://YOURTENANT.onmicrosoft.com/b2c/demo.read");
    }

Hope that helps.

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