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.

AcquireToken should return IAuthenticationResult instead of AuthenticationResult

See original GitHub issue

IPublicClientApplication.AcquireTokenAsync & IPublicClientApplication.AcquireTokenSilentAsync currently return an AuthenticationResult which is restrictive with internal ctor’s, and ultimately requires an instance of an internal class to provide a token.

This creates a problem for unit testing other libraries. While IPublicClientApplication can be mocked, there is no easy way to return a result as part of a unit test in external libraries. If AcquireTokenAsync and AcquireTokenSilentAsync were to return an IAuthenticationResult instead this would make it easy to create a mock response for unit testing other libraries.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jmprieurcommented, Apr 9, 2021

Thanks for your tip, @AmirSasson For info on the migration, in case this helps, you can checkout https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-net-migration

1reaction
jmprieurcommented, Apr 8, 2021

@AmirSasson ADAL is deprecated. We won’t change it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MSAL is difficult to test because AuthenticationResult is not ...
MSAL is not easily mockable because the AuthenticationResult is an immutable sealed class with no public constructors.
Read more >
Desktop app that calls web APIs: Acquire a token interactively
On Windows, you must call AcquireTokenInteractive from the UI thread so that the embedded browser gets the appropriate UI synchronization ...
Read more >
Acquire tokens to call a web API (daemon app)
Web, you don't need to acquire a token. You can use higher level APIs, as you see in Calling a web API from...
Read more >
AcquireToken(System.String, Microsoft.IdentityModel. ...
I am using the bytearray coming from the HttpRequest to create the x509 object. However I get this error: Message "Method not found:...
Read more >
c# - AcquireTokenSilent is Failing to acquire token silently?
AcquireTokenSilentAsync will try all ways it can to get you a valid token without prompting for an interactive auth request.
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