Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting an error of " Please authenticate using a valid token" #35

Open
maKabirkhan opened this issue Oct 4, 2022 · 11 comments
Open

Comments

@maKabirkhan
Copy link

image

@dipanjan1212
Copy link

//Try this code in Route 3 POST "/api/auth/getuser"

router.post('/getuser', fetchuser, async (req, res) => {

try {
const userId = req.user.id;
const user = await User.findById(userId).select("-password")
res.send(user)
} catch (error) {
console.error(error.message);
res.status(500).send("Internal Server Error");
}
})

@Ishita8888
Copy link

//Write this in index.js

const connectToMongo = require('./db');
const express = require('express')

connectToMongo();
const app = express()
const port = 5000

app.use(express.json())

app.use('/api/auth', require('./routes/auth'))
app.use('/api/notes', require('./routes/notes'))

app.listen(port, () => {
console.log(iNotebook backend listening at http://localhost:${port})
})

@ZAIN-BUKHARI
Copy link

ZAIN-BUKHARI commented Dec 30, 2022 via email

@Updesh413
Copy link

I am getting the same issue. Someone please help me out.

@manthankurhekar
Copy link

just provide valid jwt token

@Updesh413
Copy link

Can you please explain in detail

@manthankurhekar
Copy link

do you have discord?

@Updesh413
Copy link

yes

@manthankurhekar
Copy link

give me your id

@Updesh413
Copy link

updesh

@manthankurhekar
Copy link

check you discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants