Комментарии:
I loved the tutoria ❤❤🎉l, but I'm having a little problem with my backend refresh_token api while using mongodb as the database and mongoose for querying the database, it doesn't seem to be working and I need help with that.
Ответитьthanks
ОтветитьPitty the camera was out of focus - but otherwise a good video
ОтветитьGod Level Stuff , Loved it
ОтветитьThanks for the tutorial. Appreciated.
ОтветитьThank you for making this so understandable.
ОтветитьCan someone please explain me in simple words what did he say about versions w.r.t to refresh tokens?
ОтветитьExcellent
ОтветитьAwesome
Ответитьyou are awesome man🌷🌷 thanks for sharing your knowledge😍🙏🏻
ОтветитьHow can I ever learn thing like JWT without videos like this? Reading docs doesn't help! Thank you so much!
Ответитьi dont want to hurt your feeling but im tired of indian accent there's too much
ОтветитьHello @freecodecamp
Thanks for ur interesting and best remarkable courses you provide
but during using the refresh token to create new accesstoken, on frontend for me once I refresh the it takes me back to the login page
just help me to solve that thanks best regards
Here is my endpoint for the refreshtoken
app.post("/refresh_token", async (req, res, next)=>{
const token = req.cookies.refreshToken;
//if there is no token
if(!token) return res.json({accessToken: ''});
//if we have token
let payload = null;
try {
payload = jwt.verify(token, process.env.REFRESH_TOKEN_SECRET);
} catch (error) {
return res.send({
accessToken: ""
})
}
//let's find the user
let user = await User.findById(payload.userId);
if(!user) return res.json({accessToken: ""});
if(user.refreshToken!==token) return res.send({accessToken: ""})
let accessToken = createAccessToken(user._id);
let refreshToken= createRefreshToken(user._id);
user.refreshToken = refreshToken;
sendRefreshToken(res, refreshToken);
return res.send({ accessToken });
})
If iam logged in a website through auth redirect url token in one browser and again if iam logged in the same website in another browser, it creates another different url token for login . Then which url token will be registerd or tracked by that website ? either First one or next one..?? Thankyou for ur valuable answer in advance..!!
ОтветитьWhat font are you using? It looks beautiful
ОтветитьThanks a lot for this freecodecamp.
Ответить