title: .net core 6 OpenID(Steam) authentication from API
body: <p>I'm trying to make it available for users to Authorize through Steam.
  I'm currently working with a Frontend on port 8080 and a backend on port 5000. There is a local SSL on both services.</p>
  <p>I'm able to sign in via Steam through the backend and retrieve information, the claims, about the user logged in. The problem is that the cookie or claims that is sent after the successful login is not available from the instance of the frontend, because when the user authorize with Steam it's entirely through the backend and therefore no WebToken, cookie or session is available to the frontend.</p>
  <p>I'm using
  AspNet.Security.OpenId (6.0.0)
  AspNet.Security.OpenId.Steam (6.0.0)</p>
  <p>I currently have the following setup in the backend
  Startup.cs in ConfigureServices</p>
  <pre><code>            services.AddAuthentication(options =&gt;
              {
                  options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
              })
              .AddCookie(options =&gt;
              {
                  options.LoginPath = &quot;/Authentication/SteamLogin&quot;;
                  options.LogoutPath = &quot;/Authentication/SteamLogout&quot;;
                  options.Cookie.Domain = &quot;https://localhost:8080&quot;; //Tried to do some shared cookie thing but doesnt work
              })
              .AddSteam(options =&gt;
              {
                  options.ApplicationKey = &quot;SECRET_APP_KEY&quot;;
              });
  </code></pre>
  <p>AuthenticationController SteamAuthorize</p>
  <p>So for connecting through steam you need to access this location directly
  &quot;https://localhost:5000/Authentication/SteamAuthorize&quot;.
  Normally i would authenticate by sending a GET or POST call from the frontend so the frontend would have a relation to the backend. Here there is none because you access the action directly.</p>
  <pre><code>        [AllowAnonymous]
          [Route(&quot;SteamAuthorize&quot;)]
          [HttpGet]
          public IActionResult SteamAuthorize()
          {
              return Challenge(new AuthenticationProperties { RedirectUri = &quot;/&quot;, IsPersistent = true }, &quot;Steam&quot;);
          }
  </code></pre>
  <p>AuthenticationController Index</p>
  <p>So after the user has successfully logged in through steam the response is sent to this location.
  In here it's not a problem getting the acquired data, but now i need the claims and identity to be available when my frontend makes a request to the backend.</p>
  <pre><code>        [HttpGet(&quot;~/&quot;)]
          public async Task&lt;ActionResult&gt; Index()
          {
              var openIdSteamId = User.Claims.FirstOrDefault(c =&gt; c.Type == ClaimTypes.NameIdentifier);
  
              var steam_userName = User.Identity.Name;
  
              if (steam_userName != null &amp;&amp; openIdSteamId != null)
              {
                  var steam_userId = openIdSteamId.Value.Replace(&quot;https://steamcommunity.com/openid/id/&quot;, &quot;&quot;);
  
                  //I've tried redirecting to the frontend which then makes a new call afterwards
                  //The frontend will make a new call to this &quot;/&quot; page and now the Claims are gone
                  return Redirect(&quot;https://localhost:8080/steamauthorizing&quot;);
              }
              return Redirect(&quot;https://localhost:8080/&quot;);
          }
  </code></pre>
  <p>I've tried to set options.Cookie.Domain = &quot;https://localhost:8080&quot;; but that didn't work.
  I've generally looked for how to make the principal and claims persist through the two services.</p>
  <p>To sum the question up. How do I authenticate a third-party app, with OpenID, through my backend, with the Identity also available to my frontend?</p>