Skip to content

Example using AAD Bearer tokensΒ #7

@awaldow

Description

@awaldow

I am trying to get OData authorization working with the new Microsoft.Identity.Web library and when I set up the ODataAuthorization I get:

System.InvalidOperationException: No authenticationScheme was specified, and there was no DefaultChallengeScheme found. The default schemes can be set using either AddAuthentication(string defaultScheme) or AddAuthentication(Action<AuthenticationOptions> configureOptions).

I am calling this repos code as follows:

services.AddODataAuthorization(options =>
            {
                options.ConfigureAuthentication().AddMicrosoftIdentityWebApi(Configuration, "AzureAd");
            });

I figured since the README shows

options.ConfigureAuthentication().AddJWTAuthenticationScheme();

I could just do what I'm doing above without issue but it seems like either it's not hooked up or I'm missing some config piece for leveraging the new identity lib; maybe I'm not supposed to use it all? I tried the AddJWT scheme line as well with the same result.

I think having an example using Azure AD would be helpful, or at least some documentation somewhere regarding the Microsoft.Identity.Web lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions