Token de Autenticação Client-Server

Token de Autenticação Server-Client

Interceptor Provider

Apply API interceptor within your Contexts and other providers to be able to access Hooks and States

const AxiosInterceptor = ({ children }: { children: ReactElement }) => {
  const [isSet, setIsSet] = useState(false);

	**// Here you could be accessing any value from a context that this component is inside
  // or call any React Hook**

  useEffect(() => {
    const inteceptor = api.interceptors.response.use(() => ...);

    setIsSet(true);

    return () => {
      api.interceptors.response.eject(inteceptor);
    };
  }, []);

  return isSet && children;
};

export { AxiosInterceptor };
ReactDOM.render(
  <React.StrictMode>
    <Providers> // ANY PROVIDER THAT YOU WANT THE INTERCEPTORS HAVE ACCESS TO
      <AxiosInterceptor>
          <App />
      </AxiosInterceptor>
    </Providers>
  </React.StrictMode>,
  document.getElementById("root")
);

Microsoft SSO Silent Refresh Example