strapi-examples icon indicating copy to clipboard operation
strapi-examples copied to clipboard

Social Authentication causes 'Maximum update depth exceeded' error

Open tommyboylab opened this issue 5 years ago • 1 comments

Node.js version:

10.19.0

npm version:

6.13.4

Strapi version:

Latest (beta 20.1)

Operating system:

Mac OS

Which example is causing problem?

/good-old-react-authentication-flow

Do you want to request a feature or report a bug?

bug

What is the current behavior? Upon redirect to the FE application on localhost, receive error

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

If the current behaviour is a bug, please provide the steps to reproduce the problem

  • Quickstart a Strapi BE and fill the provider information (in this case FB)
  • Start the example, use FB to login
  • See several redirects in the URL, and shortly after this error

Strapi Callback is http://localhost:3000/connect/facebook

FE URL looks like after receiving warning: http://localhost:3000/connect/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/auth/login

What is the expected behavior?

Callback should occur, grab query params and store them in a JWT.

tommyboylab avatar May 15 '20 15:05 tommyboylab

I also come across this weird infinite-auth thing.

Could be something with Strapi's routing for third-party authentication (my case using Google), particularly the part regarding url-redirect to the frontend.

Actually I did my login flow using simply Express Apps and made the Google to redirect the JWT etc to my Express App. The redirect told me that it's using a React App and cannot find the corresponding page, which is really not right.

What I end up doing is to deploy the frontend Express App on another server, actually a Windows Server, and tell my Apache to do the corresponding proxy. Works like a charm but I don't know why and I don't think people usually have more than one server to play with.

mngyng avatar Oct 29 '20 06:10 mngyng