项目作者: sutrisna

项目描述 :
Implementasi JWT di Express JS
高级语言: JavaScript
项目地址: git://github.com/sutrisna/expressjs-jsonwebtoken.git
创建时间: 2016-11-12T18:34:08Z
项目社区:https://github.com/sutrisna/expressjs-jsonwebtoken

开源协议:

下载


expressjs-jsonwebtoken

Implementasi JWT di Express JS

Install

  • Clone this project:
    1. $ git clone https://github.com/sutrisna/expressjs-jsonwebtoken.git
    2. $ cd expressjs-jsonwebtoken
  • Install NPM dependencies:
    1. $ npm install
  • Running aplikasi:
    1. $ node bin/www

    Gunakan rest client seperti postman

  1. Generate Token
  2. route GET: localhost:3000
  3. Verify Token
  4. Tambahkan Authorization di header dan masukan hasil Generate Tokennya
  5. route GET: localhost:3000/validation

Setting expired time

  1. router.get('/', function (req, res) {
  2. var token = jwt.sign({
  3. name: 'test',
  4. },secret , {
  5. expiresIn: '60000'
  6. });
  7. res.send(token);
  8. });

NPM jsonwebtoken by

Auth0

Explore lebih lanjut kunjungi

auth0/node-jsonwebtoken

Sutrisna 1453

Jika tidak bisa sedekah dengan uang, maka bersedekahlah dengan ilmu pengetahuan