Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pete 16 posts 197 karma points
    20 days ago
    Pete
    0

    Enable azure ad token acquisition for downstream calls

    I'm trying to make calls to some of our internal apis from the an umbraco site but I am having trouble with the authentication. The apis have been secured with azure ad and the umbraco site has been given a client id and some roles which will allow it to call the app.

    When I try to implement the following code in the program file:

            builder.Services
                .AddMicrosoftIdentityWebAppAuthentication(builder.Config, "ApiSettings:AzureAD")
                .EnableTokenAcquisitionToCallDownstreamApi()
                .AddInMemoryTokenCaches();
    

    The site throws an error:

    TypeLoadException: Could not load type 'Microsoft.Identity.Web.MicrosoftIdentityOptions' from assembly 'Microsoft.Identity.Web, Version=3.2.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'.

    Unknown location

    ReflectionTypeLoadException: Could not load all types from "Umbraco.Cloud.Identity.Cms, Version=13.0.1.0, Culture=neutral, PublicKeyToken=null" due to LoaderExceptions, skipping: . System.TypeLoadException on Microsoft.Identity.Web.MicrosoftIdentityOptions: Could not load type 'Microsoft.Identity.Web.MicrosoftIdentityOptions' from assembly 'Microsoft.Identity.Web, Version=3.2.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'.

    Does anyone know how to implement this so I can generate a token when making my http client request?

Please Sign in or register to post replies

Write your reply to:

Draft