【发布时间】:2021-02-27 19:07:41
【问题描述】:
我正在使用 Next.js,我想获取 _app.js 中的 auth0 数据。
AppComponent.getInitialProps = async (ctx) => {
const { req, res } = ctx;
const tokenCache = auth0.tokenCache(req, res);
const { datToken } = await tokenCache.getAccessToken();
return { t: datToken }
}
但是当我这样做时,我得到:
Server Error
Error: Request is not available
为什么会出现此错误,以及如何从_app.js 中的 auth0 获取数据?
【问题讨论】:
标签: next.js