title: Check if the user is authenticated on the initial request
body: <p>I am using nuxt + aws amplify for the web app and I need to check if the user is authenticated to load the page details depending on that. I configured amplify so the user credentials are stored in the cookie instead of the local storage so all the information about the user can be retrieved from <code>req.headers.cookie</code>, but the code below</p>
  <pre class="lang-js prettyprint-override"><code>async nuxtServerInit (props, ctx) {
    const { Auth } = withSSRContext(ctx)
    try {
      const cognitoUser = await Auth.currentAuthenticatedUser()
      console.log(cognitoUser)
    } catch(error) {
      console.error(error)
    }
  },
  </code></pre>
  <p>gives <code>The user is not authenticated</code></p>
  <p>My amplify config:</p>
  <pre class="lang-js prettyprint-override"><code>Amplify.configure({
      sst: true,
      Auth: {
          identityPoolId: process.env.IDENTITY_POOL_ID,
          userPoolId: process.env.USER_POOL_ID,
          userPoolWebClientId: process.env.USER_POOL_CLIENT_ID,
          region: 'eu-central-1',
          mandatorySignIn: false,
          cookieStorage: {
              domain: isDev ? 'localhost;' : '.website.my',
              path: '/',
              expires: 1,
              sameSite: 'strict',
              secure: !isDev
          },
          authenticationFlowType: 'USER_PASSWORD_AUTH'
      }
  })
  </code></pre>
  <p>Login and auth work fine on client-side.</p>