New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mtr-auth

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mtr-auth

Library ini merupakan library mandatory yang akan men-*decode* **JWT Token**. Setelah service telah sukses melalui middleman dan membutuhkan auth, maka library ini akan menambahkan hasil decode token tadi ke dalam **req.auth**.

  • 2.7.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Auth Library

Library ini merupakan library mandatory yang akan men-decode JWT Token.
Setelah service telah sukses melalui middleman dan membutuhkan auth,
maka library ini akan menambahkan hasil decode token tadi ke dalam req.auth.

Selain auth token, library juga akan men-decode x-app-key untuk mendapatkan appId.
Hasil decode tersebut akan dimasukkan ke dalam req.appId.

Dependency

Library ini menggunakan package crypto-js v3.1.9-1, dotenv v7.0.0 dan jsonwebtoken v8.5.1.

Installation

npm i git+ssh://git@repository.meteor.asia/mtr-platform/libs/auth#v2.6.0

Penggunaan Auth Middleware

Tambahkan JWT Secret dan Key Secret di dalam file .env.

JWT_KEY=***************************************************************
SECRET=****************

Deklarasikan module library di dalam file app.js.

const express = require('express');
const { auth } = require('mtr-auth');

const app = express();

app.use(auth);

Penggunaan Check Subpartner Middleware

Deklarasikan module library di dalam file api.js.
Tambahkan middleware ke route yang diinginkan.

const { checkSubpartner } = require('mtr-auth');

router.use('/api-management', checkSubpartner);

FAQs

Package last updated on 09 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc