diff --git a/src/api/auth/gLogCallback.js b/src/api/auth/gLogCallback.js index a8c2f20..6b3c78b 100644 --- a/src/api/auth/gLogCallback.js +++ b/src/api/auth/gLogCallback.js @@ -37,7 +37,7 @@ export async function gLogCallback(request, reply, fastify) { return reply.code(400).send({ error: "User does not exist" }); } - const token = fastify.jwt.sign(user); + const token = fastify.jwt.sign({ user: user.username}); return reply .setCookie('token', token, { diff --git a/src/api/auth/gRegisterCallback.js b/src/api/auth/gRegisterCallback.js index 4265413..217fae5 100644 --- a/src/api/auth/gRegisterCallback.js +++ b/src/api/auth/gRegisterCallback.js @@ -49,7 +49,7 @@ export async function gRegisterCallback(request, reply, fastify) { authUserCreate(user.username, fastify) - const token = fastify.jwt.sign(user); + const token = fastify.jwt.sign({ user: user.username}); return reply .setCookie('token', token, { diff --git a/src/utils/authUserCreate.js b/src/utils/authUserCreate.js index d453285..a1d6bba 100644 --- a/src/utils/authUserCreate.js +++ b/src/utils/authUserCreate.js @@ -13,7 +13,7 @@ export async function authUserCreate(username, fastify) { const url = process.env.USER_URL || "http://localhost:3002/" await axios.post( - "http://localhost:3002/users/" + username, + url + "users/" + username, payload, { headers: {