Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Getting a stored jwt cookie and verifying it

I'm trying to make it so that some pages only render whenever an user is logged in. However, I can't seem to find any documentation on how to retrieve cookies using vue.js. My project is being made with the mevn stack. And I saved the user cookie with:

        res.cookie('token', token, {
            maxAge: 24 * 60 * 60 * 1000,
            httpOnly: true
        });

The problem I'm facing now is retrieving this cookie, so that I can verify wether the user is logged in. I can't find anything on how to do this, so I'm asking it here.

/pages/crash.vue

data() {
        return {
            foo: false,
        };
    },
    mounted() {
        // Get cookie
        // If cookie is valid 
        // Set this.foo to true
        if (this.foo) {
            ...
        } else {
            window.location.href = '/login'
        }
    },
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!