React
1
Вклад в тег
...
const token = ctx.headers['x-token'];
if (token) {
try {
const { user } = jwt.verify(token, secretOne);
ctx.user = user;
} catch (err) {
const refreshToken = ctx.headers['x-refresh-token'];
const newTokens = await refreshTokens(
token,
refreshToken,
secretOne,
secretTwo
);
}
}
...