这个问题可能是因为 withPageAuthRequired 高阶组件未正确传递 props 导致的。因此,可以通过在该组件中添加 props 参数并将其传递到包装组件中来解决此问题。例如:
import { withPageAuthRequired } from '@auth0/nextjs-auth0';
function MyProtectedPage(props) { // render page content here }
export default withPageAuthRequired(MyProtectedPage, { returnTo: '/', })(MyProtectedPage);
通过这种方式,MyProtectedPage 组件接收到的 props 将是预期的,且 withPageAuthRequired 将会在其内部实现验证。