All Projects → kandros → Micro Jwt Auth

kandros / Micro Jwt Auth

Licence: mit
jwt authorization wrapper for https://github.com/zeit/micro

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Micro Jwt Auth

Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-75.26%)
Mutual labels:  microservice, micro
Spring Security React Ant Design Polls App
Full Stack Polls App built using Spring Boot, Spring Security, JWT, React, and Ant Design
Stars: ✭ 1,336 (+1277.32%)
Mutual labels:  jwt, authorization
Got Auth Service
A professional role-based-authorization(also supports resource and group) service with restful and graphql api for enterprise applications.
Stars: ✭ 12 (-87.63%)
Mutual labels:  microservice, authorization
Micro Analytics Cli
Public analytics as a Node.js microservice. No sysadmin experience required! 📈
Stars: ✭ 743 (+665.98%)
Mutual labels:  microservice, micro
S
a go web freamwork for micro service, very very easy to create and deploy, with auto service registry and discover, high performance and based on http/2 no ssl
Stars: ✭ 67 (-30.93%)
Mutual labels:  microservice, micro
Auth0.js
Auth0 headless browser sdk
Stars: ✭ 755 (+678.35%)
Mutual labels:  jwt, authorization
Microservice learning
从零开始微服务框架使用
Stars: ✭ 31 (-68.04%)
Mutual labels:  microservice, micro
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+448.45%)
Mutual labels:  microservice, micro
Grpc Auth Example
Examples of client authentication with gRPC
Stars: ✭ 65 (-32.99%)
Mutual labels:  jwt, authorization
Awesome Micro
A collection of awesome things regarding zeit's micro.
Stars: ✭ 1,053 (+985.57%)
Mutual labels:  microservice, micro
Avatar
💎 Beautiful avatars as a microservice
Stars: ✭ 623 (+542.27%)
Mutual labels:  microservice, micro
Nextjs Jwt Example
next.js authorization example including private route protection
Stars: ✭ 72 (-25.77%)
Mutual labels:  jwt, authorization
Micro Router
🚉 A tiny and functional router for Zeit's Micro
Stars: ✭ 621 (+540.21%)
Mutual labels:  microservice, micro
Hemera
🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/
Stars: ✭ 773 (+696.91%)
Mutual labels:  microservice, micro
Learning tools
Go 学习、Go 进阶、Go 实用工具类、Go-kit ,Go-Micro 微服务实践、Go 推送
Stars: ✭ 605 (+523.71%)
Mutual labels:  micro, jwt
Access
Ponzu Addon to manage API access grants and tokens for authentication
Stars: ✭ 13 (-86.6%)
Mutual labels:  jwt, authorization
Cloudfront Auth
An AWS CloudFront [email protected] function to authenticate requests using Google Apps, Microsoft, Auth0, OKTA, and GitHub login
Stars: ✭ 471 (+385.57%)
Mutual labels:  jwt, authorization
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+396.91%)
Mutual labels:  jwt, authorization
Go Restful Api
An idiomatic Go REST API starter kit (boilerplate) following SOLID principles and Clean Architecture
Stars: ✭ 1,043 (+975.26%)
Mutual labels:  microservice, jwt
Spring Boot Webflux Jjwt
Example Spring Boot and WebFlux (Reactive Web) with Spring Security and JWT for token Authentication and Authorization
Stars: ✭ 71 (-26.8%)
Mutual labels:  jwt, authorization

Build Status npm

micro-jwt-auth

json web token(jwt) authorization wrapper for Micro

An Authorization header with value Bearer MY_TOKEN_HERE is expected

examples

with no other wrappers

'use strict'

const jwtAuth = require('micro-jwt-auth')

/*
    if Authorization Bearer is not present or not valid, return 401
*/

module.exports = jwtAuth('my_jwt_secret')(async(req, res) => {
  return `Ciaone ${req.jwt.username}!`
})

with multiple wrappers

'use strict'

const jwtAuth = require('micro-jwt-auth')

const compose = (...fns) => fns.reduce((f, g) => (...args) => f(g(...args)))

const handle = async(req, res) => {
  return `Ciaone ${req.jwt.username}!`
}

module.exports = compose(
    jwtAuth(process.env.jwt_secret),
    anotherWrapper,
    analitycsWrapper,
    redirectWrapper,
    yetAnotherWrapper
)(handle)

with whitelist of paths

Whitelisted paths make JWT token optional. However if valid token is provided it will be decoded.

'use strict'

const jwtAuth = require('micro-jwt-auth')

/*
    Bypass authentication for login route
*/

module.exports = jwtAuth('my_jwt_secret', [ 'api/login' ])(async(req, res) => {
  return `Ciaone ${req.jwt.username}!`
})

with custom responses

'use strict'

const jwtAuth = require('micro-jwt-auth')

/*
    You can overwrite the default response with the optional config object
*/

module.exports = jwtAuth('my_jwt_secret', ['api/login'], {
  resAuthInvalid: 'Error: Invalid authentication token',
  resAuthMissing: 'Error: Missing authentication token'
})(async(req, res) => {
  return `Ciaone ${req.jwt.username}!`
})

/*
  You may skip the whitelist if unnecessary
*/

module.exports = jwtAuth('my_jwt_secret', {
  resAuthInvalid: 'Error: Invalid authentication token',
  resAuthMissing: 'Error: Missing authentication token'
})(async(req, res) => {
  return `Ciaone ${req.jwt.username}!`
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].