Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

authorify-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

authorify-client

Client for Authorify authorization and authentication system for REST server

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Authorify Client

This is the client for our Authorify authentication and authorization middleware for a REST server.

Installation

Install authorify-client as usual:

$ npm install --save authorify-client

Usage

You can use authorify-client both in node and in browser environment.

Node

This client has the same approach of superagent and you can use it as shown below:

// dependencies
var fs = require('fs'),
    authorify = require('authorify-client')({
      host: 'localhost',
      debug: true,
      key: fs.readFileSync('clientCert.key'), 'utf8'),
      cert: fs.readFileSync('clientCert.cer'), 'utf8'),
      ca: fs.readFileSync('serverCA.cer'), 'utf8')
    }),
    uuid = require('node-uuid'),
    id = uuid.v4(),
    app = uuid.v4();

// set a configuration
authorify.set({
  host: 'localhost',    // host of your server
  port: 3000,           // port of your server
  id: id,               // a valid uuid
  app: app              // another valid uuid
});

// login
authorify.login('username', 'password', function(err, res) {
  authorify.post('/test')
    // send a message into the body
    .send({ name: 'alex', surname: 'smith' })
    .end(function(err, res) {
      if (!err) {
        // your logic here
      }
    });
});
Browser

To create a single file to use in browser environment use a simple script that uses browserify:

$ ./build.sh

and add the obtained authorify.js file to your html file:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>authorify-client example</title>
    </head>
    <body>
        <script src="authorify.js"></script>
        <script src="example.js"></script>
    </body>
</html>

The script example.js contanins your example code:

// you have a global authorify variable 
authorify.set({
  host: 'localhost',                            // host of your server
  port: 3000,                                   // port of your server
  id: 'ae92d22b-a9ab-458a-9850-0025dbf11fad',   // a valid uuid
  app: 'c983659a-9572-4471-a3a2-7d45b591d315'   // another valid uuid
});

// login
authorify.login('username', 'password', function(err, res) {
  authorify.post('/test')
    // send a message into the body
    .send({ name: 'alex', surname: 'smith' }))
    .end(function(err, res) {
      if (!err) {
        // your logic here
      }
    });
});

See Authorify test/browser folder to see more examples.

Run Tests

As usual we use mocha as test framework and you can run all tests simply typing:

$ npm test

For other tests (for node and browser) please read Authorify documentation and the local documentation into doc folder.

Documentation

To create your own documentation you must install JSDuck and type in your terminal:

$ cd /path-of-package
$ ./gen_doc.sh

See full documentation into doc folder.

Convention

The version number is laid out as: major.minor.patch and tries to follow semver as closely as possible but this is how we use our version numbering:

major

A major and possible breaking change has been made in the authorify core. These changes could be not backwards compatible with older versions.

minor

New features are added or a big change has happened with one of the third party libraries.

patch

A bug has been fixed, without any major internal and breaking changes.

Contributing

To contribute to the project follow the GitHub guidelines.

License

This program is released under a GNU Affero General Public License version 3 or above, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.

Keywords

FAQs

Package last updated on 11 Jun 2014

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