kdp-auth

0.0.16 • Public • Published

Kantar Development Platform


Welcome to the New KDP Authentication NPM package.

In about two minutes you'll have an app, secured using KDP. No more messing around with user accounts and password resets (you can buy us a beer later).

Getting started (and finished)

Alright, enough witty banter, let's get down to brass tacks. This is a node thing, if you don't know anything about node we suggest you go find out here... https://nodejs.org

If you know about Node the chances are you know about express (https://www.npmjs.com/package/express), that's what we're using here, so you need to create a new directory, install express and this kdp package... as below

$ npm install --save express
$ npm install --save kdp-auth

Now create a server.js file and fill it with the following...

'use strict';

var express = require('express');
var app = express();
var kdp = require('kdp-auth');

kdp.init(app);

app.get('/', function (req, res) {
    res.send('Hello World!');
});

app.listen(3000, function () {
    console.log('Example app listening on port 3000!');
});

That's it, your app is now fully secure, you can run it and take a look...

$ node server.js

Browse to http://localhost:3000/ and you'll be asked to login, when you're in go to http://localhost:3000/api/me and you'll get some details of the logged in user (hopefully you!).

Any new endpoints you create will require a user to log in to see them, yay!

Enjoy!

If you hae any questions, email us at kdp@kantar.com.

Readme

Keywords

none

Package Sidebar

Install

npm i kdp-auth

Weekly Downloads

2

Version

0.0.16

License

ISC

Last publish

Collaborators

  • daviddykeuk