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

Error when using B2C integration (inc. Example). Can't load Microsoft.IdentityModel.Tokens #6

Open
msivers opened this issue Apr 16, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@msivers
Copy link

msivers commented Apr 16, 2020

Simple to reproduce - just use the example Function App with TokenAzureB2COptions and results in error:

Exception while executing function: GetUser. AzureExtensions.FunctionToken: Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.

Here is my startup code for B2C (albeit with altered uris)...

builder.AddAzureFunctionsToken(new TokenAzureB2COptions()
{
    AzureB2CSingingKeyUri = new Uri("https://myidp.b2clogin.com/myidp.onmicrosoft.com/discovery/v2.0/keys?p=B2C_1_policy"),
    Audience = "https://myidp.onmicrosoft.com/98d8e0a8-8713-4bb7-8247-82010affa1d1",
    Issuer = "https://myidp.onmicrosoft.com/2351f626-3e64-46bf-baf8-d5096f3b5261/v2.0/"
});

The above is using the Nuget package...
<PackageReference Include="AzureExtensions.FunctionToken" Version="1.0.11" />

@msivers
Copy link
Author

msivers commented Apr 17, 2020

Looks like an issue with Microsoft.NET.Sdk.Functions... #5756

Works fine if I downgrade Microsoft.NET.Sdk.Functions to 3.0.3 (v3.0.4 - v3.0.6 causes error).

Another workaround that will allow latest version is to add the following property to the project... <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

@vitalybibikov
Copy link
Owner

vitalybibikov commented May 10, 2020

@msivers Is this still an issue?

As far as I know, currently <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
is the only solution to the problem. Haven't checked 3.0.7 yet.

@vitalybibikov vitalybibikov self-assigned this May 10, 2020
@vitalybibikov
Copy link
Owner

I have issued new version 1.0.13, though it is just an update of all the deps.

Currently, original issue can be tracked here: Azure/azure-functions-host#5894

@vitalybibikov vitalybibikov added the bug Something isn't working label May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants