title: IdentityServer4 PostLogoutRedirectUri null
body: <p>I am attempting to get the implicit flow working for IdentityServer4. Login and logout work correctly, however the PostLogoutRedirectUri is coming back null, despite setting the value where it needs to be set. What I would like is for the logout process to redirect back to my application after the logout is complete.</p>
  
  <p>I am getting the logoutId correctly, and Logout calls BuildLoggedOutViewModelAsync:</p>
  
  <pre><code>[HttpPost]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Logout(LogoutInputModel model)
      {
          var vm = await _account.BuildLoggedOutViewModelAsync(model.LogoutId);
  ...
  </code></pre>
  
  <p>This method is located in my AccountService.cs class, which then calls the GetLogoutContextAsync of the DefaultIdentityServiceInteractionService:</p>
  
  <pre><code>public async Task&lt;LoggedOutViewModel&gt; BuildLoggedOutViewModelAsync(string logoutId)
      {
          // get context information (client name, post logout redirect URI and iframe for federated signout)
          var logout = await _interaction.GetLogoutContextAsync(logoutId);
  ...
  </code></pre>
  
  <p>Which creates a IdentityServer4.Models.LogoutRequest.</p>
  
  <p>The <code>SignOutIFrameUrl</code> string property is set to <code>"http://localhost:5000/connect/endsession/callback?sid=bf112f7785bc860fcc4351893012622e&amp;logoutId=d6649e7f818d9709b2c0bc659696abdf"</code> but nothing else seems to have been populated in the LogoutRequest. </p>
  
  <p>Unfortunately, this means that the <code>PostLogoutRedirectUri</code> is null and the <code>AutomaticRedirectAfterSignOut</code> is also null, and when the <code>LoggedOut.cshtml</code> page is loaded, the <code>signout-callback.js</code> file is never loaded:</p>
  
  <pre><code>@section scripts
  {
      @if (Model.AutomaticRedirectAfterSignOut)
      {
          &lt;script src="~/js/signout-redirect.js"&gt;&lt;/script&gt;
      }
  }
  </code></pre>
  
  <p>Here are my configuration settings.</p>
  
  <p>Config.cs:</p>
  
  <pre><code>public static IEnumerable&lt;Client&gt; GetClients()
      {
          return new List&lt;Client&gt;
          {
              new Client
              {
                  ClientId = "implicit.client",
                  AllowedGrantTypes = GrantTypes.Implicit,
                  AllowAccessTokensViaBrowser = true,
                  AllowedScopes = 
                  {
                      IdentityServerConstants.StandardScopes.OpenId,
                      IdentityServerConstants.StandardScopes.Profile,
                      "ContractManagerAPI"
                  },
                  RedirectUris = { "http://localhost:9000/" },
                  PostLogoutRedirectUris = { "http://localhost:9000/" },
                  AllowedCorsOrigins = { "http://localhost:9000" },
                  RequireConsent = false,
  
              }                
          };
      }
  </code></pre>
  
  <p>app.ts (js client):</p>
  
  <pre><code>import {UserManager} from 'oidc-client';
  import { inject, Factory } from 'aurelia-framework';
  
  @inject(Factory.of(UserManager))
  export class App {
    userManager: UserManager;
  
    constructor(userManagerFactory){
      let config = {
        authority: 'http://localhost:5000',
        client_id: 'implicit.client',
        response_type: 'id_token token',
        scope: 'openid profile ContractManagerAPI',
        redirect_uri: 'http://localhost:9000/',
        post_logout_redirect_uri: 'http://localhost:9000/'
      };
  
      this.userManager = userManagerFactory(config);
    }
  
    login(){
      this.userManager.signinRedirect();
    }
  
    logout(){
      this.userManager.signoutRedirect();
    }
  }
  </code></pre>
  
  <p>Relevant parts of Startup.cs:</p>
  
  <pre><code>services.AddIdentityServer()
                  .AddTemporarySigningCredential()
                  .AddInMemoryApiResources(Config.GetApiResources())
                  .AddInMemoryClients(Config.GetClients())
                  .AddInMemoryIdentityResources(Config.GetIdentityResources())
                  .AddContractManagerUserStore()
                  .AddProfileService&lt;ContractManagerProfileService&gt;();
  </code></pre>
  
  <p>Any assistance in figuring out where I'm going wrong would be greatly appreciated.</p>
  
  <p>Thanks!</p>