CodeWithHarry / iNotebook-React

INotebook is a React Application for managing personal notes on the cloud
343 stars 193 forks source link

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

Open M-A-K-K opened 1 year ago

M-A-K-K commented 1 year ago

image

dipanjan1212 commented 1 year ago

//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 commented 1 year ago

//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 commented 1 year ago

You are on github or not ?

On Fri, Dec 30, 2022, 4:23 PM Ishita Jaiswal @.***> wrote:

//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}) })

— Reply to this email directly, view it on GitHub https://github.com/CodeWithHarry/iNotebook-React/issues/35#issuecomment-1367868212, or unsubscribe https://github.com/notifications/unsubscribe-auth/A23X73JKBIINQI55B4P3WQLWP3A3FANCNFSM6AAAAAARFSU6GM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Updesh413 commented 11 months ago

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

manthankurhekar commented 11 months ago

just provide valid jwt token

Updesh413 commented 11 months ago

Can you please explain in detail

manthankurhekar commented 11 months ago

do you have discord?

Updesh413 commented 11 months ago

yes

manthankurhekar commented 11 months ago

give me your id

Updesh413 commented 11 months ago

updesh

manthankurhekar commented 11 months ago

check you discord