What do you want to save?
Add Code snippet
New code examples
-
TypeScript 2022-02-17 11:50:06
tsconfig configuration
//type config configuration { "compilerOptions": { "outDir": "dist", "target": "ESNext", "module": "CommonJS", "moduleResolution": "node", "esModuleI... Add solution -
Javascript 2021-11-21 00:24:17
json web token npm global
$ npm install jsonwebtoken Add solution -
TypeScript 2021-11-15 01:54:14
typescript config
//type config configuration { "compilerOptions": { "outDir": "dist", "target": "ESNext", "module": "CommonJS", "moduleResolution": "node", "esModuleI... Add solution -
Other 2021-11-11 00:28:14
ejs jwt authentication
const cookieParser = require('cookie-parser') const withAuthUserId = [ cookieParser(), (req, res, next) => { const claims = jsonwebtoken.verify(req.cookies['jwt'], jwtKey) req['authUserId'] = claims['sub'] next() } ] app.get('/api/a... Add solution -
Javascript 2021-11-05 22:16:06
login middleware node js jwt
const jwt = require('jsonwebtoken'); module.exports = (req, res, next) => { try { const token = req.headers.authorization.split(' ')[1]; const decodedToken = jwt.verify(token, 'RANDOM_TOKEN_SECRET'); const userId = decodedToken.userId; ... Add solution -
Javascript 2021-10-28 07:27:13
Set up google OAuth2 Login with Express
/// STEP 2. make main.ejs // include get route, get some data callback, get some data const express = require('express'); const google = require('googleapis').google; const jwt = require('jsonwebtoken'); // Google's OAuth2 client const OAuth2 = google.a... Add solution -
-
Javascript 2021-10-13 15:58:03
How to setup Google OAuth2 login with Express Step 1 config.js
// STEP 1. Install dependencies and make config.js // project for understanding google authorization with express //set up your Node.JS project, and install the following dependencies: // cookie-parser // ejs // express // google-auth-library // googleapi... Add solution -
Javascript 2021-10-04 04:23:04
jwt implementation in node js
// index.js const express = require('express'); const jwt = require('jsonwebtoken'); const app = express(); // generate token for another API to use in req.header app.post('/login', (req, res) => { const user = { id: 1, username... Add solution