Search Header Logo
Node.js API Masterclass with Express and MongoDB - Sending JWT in a Cookie

Node.js API Masterclass with Express and MongoDB - Sending JWT in a Cookie

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

The video tutorial explains how to manage token storage using cookies and local storage, emphasizing security considerations. It introduces the Cookie Parser package for handling cookies in Node.js applications. The tutorial covers creating a function to send token responses, setting cookie expiration to match JWT expiration, and sending cookies and JSON data in responses. Testing the implementation with Postman is demonstrated, and setting the secure flag for cookies in production environments is discussed.

Read more

7 questions

Show all answers

1.

OPEN ENDED QUESTION

3 mins • 1 pt

What is the purpose of sending a token back to the client?

Evaluate responses using AI:

OFF

2.

OPEN ENDED QUESTION

3 mins • 1 pt

Why might storing a token in a cookie be safer than in local storage?

Evaluate responses using AI:

OFF

3.

OPEN ENDED QUESTION

3 mins • 1 pt

What package is used to handle cookies in the middleware?

Evaluate responses using AI:

OFF

4.

OPEN ENDED QUESTION

3 mins • 1 pt

How do you set the expiration for a cookie in the code?

Evaluate responses using AI:

OFF

5.

OPEN ENDED QUESTION

3 mins • 1 pt

What is the significance of the HTTP only flag for cookies?

Evaluate responses using AI:

OFF

6.

OPEN ENDED QUESTION

3 mins • 1 pt

How can you ensure that the secure flag is set for cookies in production?

Evaluate responses using AI:

OFF

7.

OPEN ENDED QUESTION

3 mins • 1 pt

What steps are taken to validate the token once it is sent to the client?

Evaluate responses using AI:

OFF

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?