question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Single Account - Acquire Token Overloads provide conflicting behaviour

See original GitHub issue

In Single account mode, the overloads for acquiring a token are offering different behaviors.

For example acquireToken(activity, scopes, callback) throws a NO_CURRENT_ACCOUNT exception if they user hadn’t already signed in.

See this block: https://github.com/AzureAD/microsoft-authentication-library-for-android/blob/fba4df5e50aded2370c296e25f4665549d5a5706/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java#L533-L537

However, acquireToken(AcquireTokenParameters) allows acquiring token even if the user had never signed in before.

See this block: https://github.com/AzureAD/microsoft-authentication-library-for-android/blob/dev/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java#L561-L596

We need to make the behavior consistent across each overload.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
shahzaibjcommented, May 15, 2020

@rpdome If the app is indeed expected to call signIn first in single account mode, then I think we can just modify this method to throw the NO_CURRENT_ACCOUNT_FOUND error same as the other overload.

With that being said, I’ve been thinking if we should redesign the Public Api around single account mode so that calling sign in is not required at all. Do you have historical context on why this was done this way? Or more importantly why methods like signin were even needed in addition to the acquire token methods? We can also follow on this offline if that is better.

0reactions
joshfriendcommented, Jun 4, 2020

I use single account mode and just ran into this weirdness. Also strange was the fact that acquireToken(AcquireTokenParams) totally works in place of logIn() even when no account is currently logged in.

I was upgrading from v0.2.2 which didn’t have logIn() and didn’t see anything in the wiki about it changing from acquireToken() to logIn().

Now that I think about it, I’m honestly not sure when I would ever use acquireToken().

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide for running C# Azure Functions in an isolated worker ...
Learn how to use a .NET isolated worker process to run your C# functions in Azure, which supports non-LTS versions of .NET and...
Read more >
Either remove overload champions or fix them. The ...
Unstoppable and barrier champions are fine- they provide a good challenge, but he overloads are way too overcooked. Especially on master or ...
Read more >
Using load shedding to avoid overload - AWS - Amazon.com
When a system is given more work than its resources support, it becomes slow. Computers take on work even when they're overloaded, but...
Read more >
Single Parents - an overview
Single mothers and fathers may experience role overload as they attempt to ensure ... These data would provide a frequency count of the...
Read more >
Learning the Basics
Gradle can resolve dependencies from one or many repositories based on Maven, ... It also provides you with information about any dependency conflict...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found