Pass custom cookie from Auth0 to AWS and then to Segment

Hello, I have a question is it possible to pass the “anonumousId” generated by Segment to Auth0 and then to the AWS EventBridge.

So first to explain what we want and what is our logic.

At the moment for our app for analytics we use Segment, for Authentication we use Auth0.

As pet the segment documentation about managing identity - Managing identity in Analytics.js | Segment Documentation

We see that when we load the Analytics.js library it automatically sets a cookie with “anonymous_id”.
When we navigation over our app there is not problem, that ID is send successfully to Segment and everything is ok.

But the problem is when we go to Auth0 page and more specifically if the login/signup is not successful. Because if we login successfully, there are no problems, then the “userId” is used and everything send to segment is correct.

BUT if the login fail, we dont have “userId” and we have to send that “anonymousId” to segment.
But at the moment when the login fail, the Auth0 “log_id” is sent instead of that “anonymousId” and our Segment Event fails.

So the path at the moment is → Auth0 → AWS EventBridge → Segment

And my question can we pass somehow that “anonymousId” cookie to the AWS EventBridge when the user fails to login/signup ?