added authorization flow

This commit is contained in:
2023-04-23 10:15:25 +02:00
parent 20e9a392ca
commit 70f18f75df
8 changed files with 6006 additions and 3120 deletions

9
web/server/utils/auth.js Normal file
View File

@@ -0,0 +1,9 @@
import jwt from 'jsonwebtoken'
const config = useRuntimeConfig()
export const createToken = (accessToken, refreshToken, maxAge) => {
return jwt.sign({ accessToken, refreshToken }, config.jwtSecret, {
expiresIn: maxAge,
})
}