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

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

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 Web Apps
Azure Web Apps
A feature of Azure App Service used to create and deploy scalable, mission-critical web apps.
4,305 questions
No comments
{count} votes

1 answer

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

    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.

    No comments