Auth0 Home Blog Docs

React-router-dom and callback rendered twice

#1

I’m trying to log in to my React application using Auth0 as a proxy for Azure AD B2C. The connection is configured on Auth0’s side and everything seems to work fine until the callback URL is called on my app. I followed all the instructions in the React Quick Start and it seems that my Callback component is rendered twice by react-router-dom, which results in 2 successive calls to parseHash, the first one with authResult non-null and err null, the second one with authResult null and err set to an error that says “invalid token: state does not match”.

In fact, the issue is exactly the same as the one reported in this question, except that I only use react-router-dom, and not connected-react-router. Can anyone confirm there is a compatibility issue with the latest version of react-router-dom (4.3.1)? If so, does that mean I have to use another routing library?