I am trying to get a dotnet core api up and running but it needs to be able to accept bearer tokens generated in an asp.net mvc application.

In the mvc application I enabled DataProtection and persist the keys to Azure Blob storage. I also configured DataProjection in the netcore api and read the key from Azure.

My understanding is that I have to add the following in the netcore app:

services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
                .AddJwtBearer(options =>
                {
                    options.TokenValidationParameters = tokenValidationParameters;
                });

On the tokenValidationParameters, I need to set the IssuerSigningKey. Should I then use the key used by DataProtection for this? It only makes sense as this is the key being used to generate the token asp.net mvc side. How do I do that?

0 Answers