Next.js 13 how to Access an External API from an API Route using App Router api route?

Hi @arundas.tc,

When refreshing tokens, you need to ensure that the session is updated to extend the session. You can do this by including the refresh: true parameter.

For example:

export default async function MyHandler(req, res) {
  const accessToken = await getAccessToken(req, res, {
    refresh: true,
    afterRefresh,
  });
};

(Reference: AccessTokenRequest | @auth0/nextjs-auth0)

Let me know how this goes for you.

Thanks,
Rueben

1 Like