<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D51Y00009hLwsASASOkta Classic EngineIntegrationsAnswered2024-03-25T20:17:03.000Z2020-10-15T12:15:03.000Z2020-10-27T23:35:42.000Z

xs3f4 (xs3f4) asked a question.

Dotnet core OKTA not accepting Authorization header token from React

Hi Guys & Girls,

 

I recently created a React Frontend with OKTA auth that works fine. I've added my token to the Authorization header to be sent to my Dotnet core backend( as per the Okta tutorial: https://developer.okta.com/docs/guides/sign-into-spa/react/use-the-access-token/).

 

The problem is, when the request with header is sent, it causes this error:

 

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.

  at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)

  at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()

  at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()

  at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()

  at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)

  at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)

  at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

 

HEADERS

=======

Accept: application/json, text/plain, */*

Accept-Encoding: gzip, deflate, br

Accept-Language: en-US,en;q=0.9

Authorization: Bearer (AUTH TOKEN HERE)

Cache-Control: no-cache

Connection: close

Host: localhost:44300

Pragma: no-cache

Referer: http://localhost:44350/

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36

origin: http://localhost:44350

sec-fetch-site: cross-site

sec-fetch-mode: cors

sec-fetch-dest: empty

 

I am setting my dotnet core backend up as specified in Okta tutorial: https://developer.okta.com/docs/guides/protect-your-api/aspnetcore3/configure-packages/

 

Issuer is the same on both back and frontend...    issuer: 'https://xxx.oktapreview.com',

 

Would anyone know what is causing this? It doesn't seem to like any token, especially any with 'bearer' prefixing it, but that's what the tutorial says....

 

 


  • Hello Colin,

     

    We suggest you to open a ticket directly to the support department, since one of our developers need to analyze your settings for a better understanding of the situation.

     

    Kind regards,

    Andrei P. Cirstea

    Technical Support Engineer

    Expand Post
    Selected as Best
  • Hello Colin,

     

    We suggest you to open a ticket directly to the support department, since one of our developers need to analyze your settings for a better understanding of the situation.

     

    Kind regards,

    Andrei P. Cirstea

    Technical Support Engineer

    Expand Post
    Selected as Best
This question is closed.
Loading
Dotnet core OKTA not accepting Authorization header token from React