K
K
Konstantin2019-03-14 07:10:59
Vue.js
Konstantin, 2019-03-14 07:10:59

Vue how to properly use JWT?

Good afternoon.
Can someone tell me how to use JWT correctly?
Who speaks through interception, who through Vuex.
What is the best option?
generate JWT in login function

const token = jwt.sign({
                email: isUser.email,
                userId: isUser._id
            }, keys.jwt, {expiresIn: 3600})

            res.status(200).json({
                token: `Bearer ${token}`
            })

How can I properly check for authenticity, can anyone tell me?
And how to send it correctly via Vuex or Header?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2019-03-15
@dragon11

Tell me how to check the token for the lifetime?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question