Skip to content

Commit 0d87723

Browse files
committed
fix: destructure 'access-token' in headers
1 parent 57f5eac commit 0d87723

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/controllers/v3/utils/user.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const userEndpoint = async (req, res, next) => {
4747
message: 'Token updated successfully',
4848
});
4949
} else if (method === 'GET') {
50-
const { id, email, accessToken } = headers;
50+
const { id, email, 'access-token': access_token } = headers;
5151

5252
// Check for required User ID in the headers
5353
if (!id) {
@@ -66,7 +66,7 @@ const userEndpoint = async (req, res, next) => {
6666
email: email,
6767
password: crypto.randomBytes(22).toString('base64'),
6868
token: generateToken(id, process.env.HMAC_KEY),
69-
access_token: accessToken,
69+
access_token: access_token,
7070
// Add other fields in the "newUser" object based on your schema
7171
};
7272

@@ -78,7 +78,7 @@ const userEndpoint = async (req, res, next) => {
7878
// Update user's token in the database
7979
await Users.updateOne(
8080
{ _id: { $eq: id } },
81-
{ $set: { access_token: accessToken } },
81+
{ $set: { access_token: access_token } },
8282
{ upsert: true }, // Create the document if it doesn't exist
8383
);
8484

0 commit comments

Comments
 (0)