Azure .NET 3.1 Web app container not allowing passport browser cookie to be set

Travis Steelman 1 Reputation point
2021-05-09T15:56:09.763+00:00

I am having an issue with an Angular 8 app running on Azure not setting an authorization cookie coming from a passport js local strategy. This works just fine when I run the app locally and point to the remote API? Any guidance would be much appreciated.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,956 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,136 Reputation points Microsoft Employee
    2021-05-10T23:04:46.357+00:00

    Hi @Travis Steelman ,

    Just to make sure I understand, you have .NET core 3.1 app hosting an Angular app e.g. dotnet new angular and

       app.UseSpa(spa =>  
       {  
           spa.Options.SourcePath = "ClientApp";  
         
           if (env.IsDevelopment())  
           {  
               spa.UseAngularCliServer(npmScript: "start");  
           }  
       });  
    

    ClientApp has passport-local installed and running LocalStategy. The remote API is open, serving resources, and ClientApp only calls remote API when a user has been locally authenticated. If I'm misunderstanding, please elaborate on which bit is .NET, how is Angular being served, and where is the NodeJS API running, what does passport.Authenticate return?

    My first thought is this is a CORS issue, and you'll have to add it to your app service.

    0 comments No comments