Socket
Socket
Sign inDemoInstall

tozny-auth

Package Overview
Dependencies
45
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tozny-auth

API interface for the Tozny authentication service, with Passport strategy for easy integration in Express apps


Version published
Weekly downloads
29
increased by45%
Maintainers
1
Install size
4.35 MB
Created
Weekly downloads
 

Readme

Source

tozny

tozny-auth npm module

NPM version Dependency Status devDependency Status

NodeJS SDK for with the Tozny authentication service. Provides functions for making API calls to Tozny, and a Passport strategy for easily adding Tozny support to any Express app.

Usage

Passport is an authentication framework for Express. Using Passport, you can add Tozny support to your app by instantiating the Tozny strategy:

var passport = require('passport')
  , tozny    = require('tozny-auth');

var realm = new tozny.Realm(realmKeyId, realmSecret, apiUrl);
passport.use(new tozny.Strategy(realm));

Then create a login handler using passport:

app.post('/login',
  passport.authenticate('tozny', {
    successRedirect: '/',
    failureRedirect: '/login'
  }));

There are some more details required to get Passport fully set up. See examples/secretmessage/index.js for a documented, working example.

API Documentation

This library includes detailed documentation for API functions, generated from source file comments. The documentation is built using jsduck, which you will need to install.

Run the command:

npm run doc

Then view the documentation by opening doc/index.html.

Running the Tests

Install project dependencies:

npm install

Then run the tests:

npm test

Some of the tests included run against a live Tozny instance. To run those tests, it is necessary to set environment variables with credentials for making Tozny API requests. To run the complete test suite, set these environment variables:

  • REALM_KEY_ID
  • SECRET
  • API_URL
  • USER_ID

The USER_ID variable may correspond to any user record in the given realm.

Keywords

FAQs

Last updated on 09 Sep 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc