title: Connecting Blazor Wasm to Identity Server 4 - Register and account management links not working
body: <p>Hopefully someone can guide me in the right direction, because I've been working on this for a while now.</p>
  <p>I've create a Blazor WASM hosted in .Net Core. However instead of using the identity in the Server (API) project, I wanted to use for authentication an Identity Server hosted in a different project (so that I can use a standalone Identity Server).</p>
  <p>I've create an Identity Server 4 project and also scaffold-ed the Identity Razor pages (so that I have the full flow with registration, account management, password recovery etc.) instead of the basic 3 or so pages that Identity Server generates.</p>
  <p>In my Blazor Client project I've added the following inside the Main method:</p>
  <pre><code>{
      // Bind to the oidc section in the appsettings.
      builder.Configuration.Bind(&quot;oidc&quot;, options.ProviderOptions);
       options.UserOptions.RoleClaim = JwtClaimTypes.Role;
  })
  </code></pre>
  <p>Also, in my appsettings file I have the following oidc section:</p>
  <pre><code>  &quot;oidc&quot;: {
      &quot;Authority&quot;: &quot;https://localhost:5001&quot;,
      &quot;ClientId&quot;: &quot;ProjectAllocation.Client&quot;,
      &quot;DefaultScopes&quot;: [
        &quot;openid&quot;,
        &quot;profile&quot;,
        &quot;roles&quot;,
        &quot;offline_access&quot;
      ],
      &quot;PostLogoutRedirectUri&quot;: &quot;/&quot;,
      &quot;ResponseType&quot;: &quot;code&quot;
    }
  }
  </code></pre>
  <p>In Identity Server, in the Startup ConfigureServices I am redirecting the Login \ Logout to use the pages in the scaffolded Identity Area:</p>
  <pre><code>var builder = services.AddIdentityServer(options =&gt;
     {
        ...
        options.UserInteraction.LoginUrl = &quot;/Identity/Account/Login&quot;;
        options.UserInteraction.LogoutUrl = &quot;/Identity/Account/Logout&quot;;
        options.Authentication = new IdentityServer4.Configuration.AuthenticationOptions
        {
           CookieLifetime = TimeSpan.FromHours(10), // ID server cookie timeout set to 10 hours
           CookieSlidingExpiration = true
        };
  })
  </code></pre>
  <p>Now the login and logout work and it seems I am getting the right token data in the client; I haven't implemented the API on the server side yet.</p>
  <p>My problem is that the register and the account management links from the Client project are not working. If you would use the template from the VS with integrated identity server then you would be able to click on the register link inside the client app and be taken to the Account\Register page in the Identity area; also once you logged in you can click on the &quot;Hello ....&quot; link and be taken to the Account management in the Identity area.</p>
  <p>However this doesn't work in my case. If I navigate from the browser directly to those areas then it works (i.e.: browse to https://localhost:5001/Identity/Account/Register: it works).
  When I click on Register button in the Client app it just reloads the app with the following link:
  https://localhost:44395/?returnUrl=%2Fauthentication%2Flogin : it looks as if the app is being asked to login, even though the Register page in the Identity Server is marked to allow anonymous access.</p>
  <p>I am really puzzled as to why this doesn't work. I can't figure out which settings in the Blazor project sets the links to navigate to via the RemoteAuthenticatorView. I am considering replacing the register button so that it doesn't navigate via the RemoteAuthenticatorView anymore and instead it uses a regular link directly to the Identity Server Register page, but I am not sure what the implications are; also it's really annoying that I cannot get this to work properly.</p>
  <p>I've even tried to change the path to the register page so that instead of Identity/Account/Register is Account/Register via the ConfigureServices in the Startup file in the Identity Server 4:</p>
  <pre><code>services.AddRazorPages(options =&gt; {
                  options.Conventions.AddAreaPageRoute(&quot;Identity&quot;, &quot;/Account/Register&quot;, &quot;Account/Register&quot;);
              });
  </code></pre>
  <p>which works from the browser (https://localhost:5001/Account/Register), but it still didn't work from the WASM Blazor Client.</p>
  <p>Any ideas?</p>
  <p>Thanks,
  Raz</p>