Could not resolve type with token 010000dd (from typeref, class/assembly Microsoft.Identity.Client.ClientCredential
See original GitHub issueWhich 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:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
@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.
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)