Thank you,
I’m getting an error still:
Most likely I’ve just written the code wrong - being brand new to NextJS and coding in general, I don’t have the logicunderstanding yet to diagnose. Here is the code for my protected page. Would hugely appreciate if you could let me know where I’ve gone wrong.
import { getSession } from "next-auth/react";
import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";
import Link from "next/link";
function Protected({ message, nftList }) {
  return (
    <div>
      <h3>Protected content</h3>
      <p>{message}</p>
      <pre>{JSON.stringify(nftList, null, 2)}</pre>
    </div>
  );
}
export async function getServerSideProps(context) {
  const session = await getSession(context);
  if (!session) {
    return {
      redirect: {
        destination: ".../pages/index.js",
        permanent: false,
      },
    };
  }
  if (!Moralis.Core.isStarted) {
    await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
  }
  const nftList = await Moralis.EvmApi.nft.getWalletNFTs({
    chain: EvmChain.ETHEREUM,
    address: session.user.address,
    // replace "0x..." with your NFT token address
    tokenAddresses: ["0x495f947276749ce646f68ac8c248420045cb7b5e"],
  });
  if (nftList.raw.total > 0) {
    return {
      redirect: {
        permanent: false,
        destination: "/videos",
      },
      props: {},
    };
  }
}
export default Protected;
Thanks