我无法在 getServerSideProps 中使用 HTTPS 的 getSession() 。
\n这正常吗?我尝试了很多次。
\n如果使用 HTTPS 我会得到它。我无法在 getServerSideProps 中使用 getSession()
\n__Secure-next-auth.callback-url\n__Secure-next-auth.session-token\n__Host-next-auth.csrf-toke\nRun Code Online (Sandbox Code Playgroud)\n如果使用 HTTP 并且我可以在 getServerSideProps 中 getSession() 就可以了
\nnext-auth.callback-url\nnext-auth.session-token\nnext-auth.csrf-token\nRun Code Online (Sandbox Code Playgroud)\n如何在 getServerSideProps 中的 HTTPS getSession() 上修复它?
\n我在 http 或 https 上运行相同的代码进行测试
\n如果使用 http 运行,我可以获得 props.session\n 如果使用https运行,我无法获取 props.session
\nimport { getSession } from 'next-auth/client';\n\nexport default function Home(props) {\n console.log(props.session);\n return (\n <div>\n <h1>Server Side Rendering</h1>\n </div>\n );\n}\nexport async function getServerSideProps(context) {\n return {\n props: {\n session: await …Run Code Online (Sandbox Code Playgroud)