Here is the better and simple solution to implement this : https://medium.com/@sundargautam2022/implementing-refresh-token-with-nextjs-15-using-app-router-with-cross-api-different-api-5682f83f9802