In OpenIdConnect getUser returns null , even after the receiving token

after successfully authenticated by the Identity Server return token and redirected app.ts but when I call getUser () in app.ts it will return null and also this code working properly in localhost.but when I try in server didn’t work.

  constructor(private openIdConnect: OpenIdConnect, private httpClient: HttpClient) {
    debugger;
    let mgr = this.openIdConnect.userManager;
    this.openIdConnect.userManager.getUser().then((user) => {
      if (user) {
        this.user = user;
        console.log(" This.User: "+this.user);
        console.log(" User: "+ user)      
      }else{
        console.log(" logout ");
         this.logout();
      }
    });
  }

The Problem was the way I build the app to production.So earlier I used "au build --env prod " I changed it to “au build --env