Foal Framework 2.0: What's New?

Foal Framework 2.0: What's New?

Foal Framework 2.0: What's New? This article presents some improvements introduced new in version 2 of Foal. In version 2, Foal provides two dedicated functions to manage JWT with cookies.

This article presents some improvements introduced in version 2 of FoalTS:

  • the JWT utilities to manage secrets and RSA keys,
  • the JWT utilities to manage cookies,
  • and the new stateless CSRF protection.

JWT - Accessing config secrets and public/private keys

Starting from version 2, there is a standardized way to provide and retrieve JWT secrets and RSA public/private keys: the functions 

getSecretOrPublicKeyandgetSecretOrPrivateKey.

Using secrets

In this example, a base64-encoded secret is provided in the configuration.

JWT_SECRET="Ak0WcVcGuOoFuZ4oqF1tgqbW6dIAeSacIN6h7qEyJM8="
settings:
  jwt:
    secret: "env(JWT_SECRET)"
    secretEncoding: base64

Both 

getSecretOrPublicKeyandgetSecretOrPrivateKey functions will return the secret.

In the case a 

secretEncodingvalue is provided, the functions return a buffer which is the secret decoded with the provided encoding.

javascript typescript node nodejs jwt csrf

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

JWT Authentication Tutorial in NodeJS - JWT Tutorial

In this video I will teach you guys how to create an authentication system using JWT in NodeJS.

Serverless Node TypeScript

Serverless Node TypeScript is a starter kit to write serverless applications by using the Serverless Framework in Node.js and TypeScript. An Apollo GraphQL server and a REST endpoint come configured out of the box

NodeJS + TypeScript, How to Set Up

NodeJS + TypeScript, How to Set Up

A template for Node.js & TypeScript.

typescript-starter .A template for Node.js & TypeScript.

Setting up TypeScript and Node with Express

In this video, I have talked about setting up TypeScript and NodeJS with Express.