refactor(api): return both refresh and access tokens at login endpoint
This commit is contained in:
parent
4139f6fd58
commit
ce11745bd0
@ -28,11 +28,14 @@ export default eventHandler(async (event) => {
|
|||||||
message: 'Account inactive!<br><a href="/activate/resend">Resend verification</a>?',
|
message: 'Account inactive!<br><a href="/activate/resend">Resend verification</a>?',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let tok = user.generateJWT(useRuntimeConfig().jwt);
|
let tok = user.generateRefreshToken(useRuntimeConfig().jwt);
|
||||||
// setCookie(event, "rockfic_cookie", tok);
|
// setCookie(event, "rockfic_cookie", tok);
|
||||||
return {
|
return {
|
||||||
user,
|
user,
|
||||||
token: tok,
|
token: {
|
||||||
|
refresh: tok,
|
||||||
|
access: user.generateAccessToken(useRuntimeConfig().jwt),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw createError({ statusCode: 401, message: wrongMsg });
|
throw createError({ statusCode: 401, message: wrongMsg });
|
||||||
|
Loading…
Reference in New Issue
Block a user