首页 > 解决方案 > 渲染服务器端时如何在 apollo 中使用来自 next-auth/react 的 GetSession?

问题描述

在为 apollo 客户端创建链接时,如何使用 getSession 检索令牌?它与 getSession 一起在客户端工作得很好。服务器端它重新调整 null。我知道 getSession 通常需要一个 req 参数,但 apollo 客户端文件中不存在该参数。

在尝试使用会话中的令牌获取 getServerSideProps (nextjs) 中的数据时。

标签: next.jsapollonext-auth

解决方案


推荐阅读