Backend for frontend auth workflow for Spring Cloud Gateway and Next.js

I am interested in setting up a “Backend for Frontend” authentication style similar to the one in this article using next.js as the client and a spring boot backend using Spring Cloud Gateway as the edge-service talking to my many microservices.

Basically, I want my next.js frontend to handle login and create a session cookie that can be transferred to my backend on every REST call. My backend with deals with getting the access token and will use Redis to map the cookie with the access token and send back the information to the logged-in user. Can anyone point me In the right direction to set up this workflow?