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.

Could not resolve type with token 010000dd (from typeref, class/assembly Microsoft.Identity.Client.ClientCredential

See original GitHub issue

Which Version of MSAL are you using ? Note that to get help, you need to run the latest preview or non-preview version For ADAL, please log issues to https://github.com/AzureAD/azure-activedirectory-library-for-dotnet 2.3.1-preview

Which platform has the issue? Xamarin android, Xamarin iOS

What authentication flow has the issue?

  • Desktop
    • Interactive
    • Integrated Windows Auth
    • Username / Password
    • Device code flow (browserless)
  • Mobile
    • Xamarin.iOS
    • Xamarin.Android
    • UWP
  • Web App
    • Authorization code
    • OBO
  • Web API
    • OBO
  • Daemon App
    • Client credentials

Other? - please describe;

What is the identity provider ?

  • Azure AD
  • Azure AD B2C

If B2C, what social identity did you use?

Repro

class MyService {
    ClientCredentials appCredentials = new ClientCredential(Constants.AppAuthentication.ClientSecret);
    ConfidentialClientApplication cca = new ConfidentialClientApplication(
                Constants.AppAuthentication.ClientId, 
                $"{Constants.AppAuthentication.Authority}/oauth2/authorize", 
                "urn:ietf:wg:oauth:2.0:oob", appCredentials, null, null);
}

Expected behavior Expect to be able to instantiate ClientCredentials and ConfidentialClientApplication

Actual behavior Runtime error occurs when instantiating class containing a ClientCredential variable in iOS and Android apps.

Could not load type of field ‘MyService:appCredentials’ (0) due to: Could not resolve type with token 010000dd (from typeref, class/assembly Microsoft.Identity.Client.ClientCredential, Microsoft.Identity.Client, Version=2.3.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae) assembly:Microsoft.Identity.Client, Version=2.3.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae type:Microsoft.Identity.Client.ClientCredential member:(null) signature:<none>

Possible Solution

Additional context/ Logs / Screenshots At first I thought this could be related to NuGet caching, however, we’ve tried multiple versions of the library (2.x.x+), cleaned/rebuilt/restarted/etc., with no luck. Tried on multiple machines as well. I am able to successfully use this code running a LinqPad script on windows, however, when running the Xamarin app in either the iOS sim or Android sim, the exception will be thrown when the class is instantiated. Also, we are using a PublicClientApplication in the same app without any issues.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
bgavrilMScommented, Oct 30, 2018

@teelinmaloney - ConfidentialClient is not supported on iOS and Android - only the public client. The exception you get is a bug - I assume that your auth code is in the “shared” assembly, which is a NetStandard assembly. The Netstandard assembly exposes ConfidentialClient, so that it can be used in .net core applications. On iOS and Android we should throw PlatformNotSupportedException. @jmprieur to prioritize the bug.

@teelinmaloney - Does your scenario require a non-interactive auth flow? If your app is ok with popping up the browser, then please use PublicClientApplication.

0reactions
jmprieurcommented, Nov 12, 2018

yes, for this scenario that’s the best approach. Closing this issue. Knowing that we want to improve the exceptions (to an answer to the initial question See #679)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not resolve type with token 01000021 from typeref
I am trying to create virtual appointments based on this documentation: ...
Read more >
Could not resolve type with token 01000021 from typeref
TypeLoadException: Could not load type of field 'Microsoft.Graph.TokenCredentialAuthProvider+. Microsoft Graph Teamwork API.
Read more >
Could not resolve type with token 0100004a from typeref ...
getting this error while i compile the project Error Mono.Linker.MarkException: Error processing method: 'System.Byte[] HeavenTaste.
Read more >
"Could not load file or assembly 'Microsoft.Identity.Client ...
Client in the output of that command. Tip: in visual studio, you can use CRTL+F to open a search bar, then you can...
Read more >
Why does Azure AD issue access tokens with client ...
I am able to get access tokens from Azure AD with client credentials grant irrespective of the scope (resource), is this expected?
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