title: Okta: Unable to obtain configuration from: 'System.String'
body: <p>I'm building an app using Okta for authentication, but the API requests will always return a 500 error. I use <code>@okta/okta-react</code> to get the access token, but when sending in the Authorization header (<code>Bearer {accessToken}</code>) the server is unable to handle it.</p>
  <p>The server replies with the following error for every request.</p>
  <pre><code>Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]
        Exception occurred while processing message.
  System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
   ---&gt; System.IO.IOException: IDX20807: Unable to retrieve document from: 'System.String'. HttpResponseMessage: 'System.Net.Http.HttpResponseMessage', HttpResponseMessage.Content: 'System.String'.
     at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
     at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
     at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
     --- End of inner exception stack trace ---
     at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
     at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
  </code></pre>
  <p>I'm using the Okta.AspNetCore package for the configuration. My startup class has</p>
  <pre class="lang-cs prettyprint-override"><code>public void ConfigureServices(IServiceCollection services)
  {
  
  services.AddAuthentication(options =&gt;
      {
          options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;
          options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;
          options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;
      })
      .AddOktaWebApi(new OktaWebApiOptions()
      {
          OktaDomain = Configuration[&quot;Okta:Authority&quot;],
      });
  
  services.AddAuthorization();
  services.AddControllersWithViews();
  
  ...
  }
  </code></pre>
  <p>and</p>
  <pre class="lang-cs prettyprint-override"><code>public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  {
      app.UseRouting();
      app.UseAuthentication();
      app.UseAuthorization();
      app.UseEndpoints(endpoints =&gt; ...
  }
  </code></pre>
  <p>I've done a lot of searching around for answers, but most of them are similar, but not the same issue. Any help would be appreciated!</p>