0

I'm using react oidc in my application. When I try to access the protected "/admin? url everything goes fine and I get "Authentication complete" screen but after some time the screen changes to "Error Authentication". It sends a request to /token url, which is unauthorized and gives 401 error.

How can I fix or debug this issue? Here's my code:

import './App.css';
import RouteList from './Routes';
import { BrowserRouter as Router } from "react-router-dom";
import { OidcProvider } from '@axa-fr/react-oidc';

const configuration = {
  client_id: 'nz6VnKCiUIjf2WPY8DvLqCy4ImyHButQHEt6jUfl',
  redirect_uri: 'http://localhost:3000',
  silent_redirect_uri: window.location.origin + '/authentication/silent-callback', // Optional activate silent-signin that use cookies between OIDC server and client javascript to restore the session
  scope: 'openid',
  content_type: 'application/x-www-form-urlencoded',
  authority: 'http://localhost:8000/oauth',
  grant_type: 'code',
  service_worker_relative_url:'/OidcServiceWorker.js',
  service_worker_only:true,
};


function App() {
  return (
    <OidcProvider configuration={configuration} >
      <div className="App">
        <Router>
          <RouteList />
        </Router>
      </div>
    </OidcProvider>
  );
}

export default App;

I want to get access token screen when I try to go to the protected admin page. Here are the logs:

"POST /oauth/token/ HTTP/1.1" 401 27

0 Answers0