Dashboard constantly refreshing

I have narrowed the problem down to the JWT token refresh. I have updated the auth code in the config/admin.ts file to the following:

auth: {
    secret: env('ADMIN_JWT_SECRET'),
    options: {
        expiresIn: '7d', // Set the token expiration to 7 days
      },
  },

Rebuilt and restarted but it is still the same. Does anybody have any other ideas? In develop I can put up with it but if it happens in production its unacceptable.
Thanks