title: How to decode a token in Next.js middleware?
body: <p>I am setting an encoded cookie in one of my nextjs component</p>
  <pre><code>setCookie(&quot;_SYS_USER_AUTH&quot;, window.btoa(res?.data));
  </code></pre>
  <p>I want to access the same in Nextjs middleware like this</p>
  <pre><code>export function middleware(request) {
    const { cookies, url } = request;
    const jwt = cookies.get(`_SYS_USER_AUTH`);
    if (request.nextUrl.pathname.startsWith(&quot;/account&quot;)) {
       console.log(window.btoa(jwt));
    }
  }
  </code></pre>
  <p>Here I am getting window is not defined error. Is there any other way I can decode this in nextjs middleware?</p>