title: How to access Blazor WASM session storage in Program.cs?
body: <p>I am trying to implement a Microservices project with a Blazor WASM front end. I am using Google as my identity provider, and have successfully setup authentication for the front end.</p>
  <p>However, with the next step I want to send over my <code>id_token</code> and <strong>not my</strong> <code>access_token</code> to my Gateway API in order to confirm the user is authenticated when they are hitting my endpoints. I've read the documentation provided by Microsoft and there is no guidance on this. <a href="https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/additional-scenarios?view=aspnetcore-5.0" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/additional-scenarios?view=aspnetcore-5.0</a></p>
  <p>I am trying to accomplish this myself by configuring the HTTP client at <code> Program.cs</code>, but can't figure out how to grab the <code>id_token</code> from the session storage.</p>
  <pre><code> builder.Services.AddHttpClient(&quot;GatewayApi&quot;, async client =&gt;
              {
                  client.BaseAddress = new Uri(builder.Configuration[&quot;GatewayServiceConfiguration:BaseUrl&quot;]);
                  client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(&quot;Bearer&quot;, GOOGLE_ID_TOKEN_GOES_HERE);
              });
  </code></pre>
  <p>I've only seen Blazor session storage available via razor pages, and never in the startup itself. Any suggestions?</p>