Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @hacdias/indieauth-middleware with all npm packages installed. Try it out:

var indieauthMiddleware = require("@hacdias/indieauth-middleware")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@hacdias/indieauth-middleware v1.0.1

A simple IndieAuth middleware that can be used with Express.js


This is a simple IndieAuth middleware that can be used in conjunction with Express.js or any other framework that uses a similar API.


$ npm i --save @hacdias/indieauth-middleware


This example uses express.js as the middleware framework but you can use anything as long as you provide an object with the JSON or the form encoded data.

const indieauth = require('@hacdias/indieauth-middleware')
const express = require('express')

const app = express()

  me: '',                       // Your domain
  endpoint: ''    // The endpoint used to check the tokens
}))'/', (req, res) => {
 if (!req.hasScope(['updates'])) {
   // req.hasScope already returns a 401 unauthorized if the user does not
   // have the required scopes.

 // Do your job...


PRs accepted.


MIT © Henrique Dias

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free