Custom Login Form, adding Social Connect. How to set state

Hello,

We have custom sign-up and sign-in views that run within our own Next.js app. We utilize the Auth0 API directly to communicate with Auth0 for signing in and creating users. We utilize nextjs-auth0 to authorize endpoints, etc. It all works fine. We are now adding social connections (google, facebook, etc). Google connection is setup within Auth0. We can redirect users to the appropriate URL (per the API docs). We’re using the nextjs-auth0 callback handlers, which expect for a state cookie to exist, so we are setting one and including the state query param in the redirected URL … But we’re getting errors during social login callback of a missing state.

Upon further digging through the nextjs-auth0 library it is clear that the library is doing some work to encode/decode cookies. As such our attempts to simply set a state cookie is failing. It also doesn’t appear that the library exports the functionality needed for us to set the cookie in a way that it will find it acceptable.

Is there a path to set the state cookie on our own in such a way that nextjs-auth0 will find it during the social login callback?

Thanks,
J