flask-session-cookie-decoder
TypeScript icon, indicating that this package has built-in type declarations

1.0.18 • Public • Published

Flask Session Cookie Decoder

A Node.js module for decoding Flask session cookies, allowing you to extract and decompress the data stored within them.

Installation

To install the package, use npm:

npm install flask-session-cookie-decoder

Usage

const { getDecodedSessionCookieJson, getCookieValueByName } = require('flask-session-cookie-decoder');

const cookie = getCookieValueByName('YOUR_COOKIE_NAME_HERE');
const decodedData = getDecodedSessionCookieJson(cookie);

console.log(decodedData);

Function Signature

getDecodedSessionCookieJson(cookie: string): string
getCookieValueByName(name: string): string

Parameters

  • cookie (string): The Flask session cookie to decode. This should be a string representing the Flask session cookie obtained from the client's request.

Returns

  • A string representing the decoded JSON object contained within the Flask session cookie.

Example

const { getDecodedSessionCookieJson, getCookieValueByName} = require('flask-session-cookie-decoder');

const cookie = getCookieValueByName('session');
// example of cookie value: 'eyJpZCI6NSwibmFtZSI6Iml0c2Rhbmdlcm91cyJ9.6YP6T0BaO67XP--9UzTrmurXSmg'
const decodedData = getDecodedSessionCookieJson(cookie);

console.log(decodedData); // {"id": 5, "name": "itsdangerous"}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Readme

Keywords

Package Sidebar

Install

npm i flask-session-cookie-decoder

Weekly Downloads

46

Version

1.0.18

License

MIT

Unpacked Size

6.07 kB

Total Files

5

Last publish

Collaborators

  • nmarkoborodova