Socket
Socket
Sign inDemoInstall

ddp-login

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddp-login

WIP! Login to a Meteor server via DDP and obtain an authentication token


Version published
Weekly downloads
130
decreased by-30.11%
Maintainers
1
Weekly downloads
 
Created
Source

ddp-login

ddp-login makes it super easy to programmaticly authenticate with Meteor server using the DDP protocol.

It is an node.js npm package built on top of the ddp package.

Installation

# For programmatic use in a node.js program:
npm install ddp-login

# For use in shell scripts
npm -g install ddp-login

Usage

There are two possible ways to use this package.

In node.js

If you'd like to log in and obtain an authentication token from a Meteor server within a node.js program:

var DDP = require('ddp');
var login = require('ddp-login');

var ddpClient = new DDP({
  host: "localhost",
  port: 3000
});

// Options below are the defaults
login(ddpClient,
  {
     env: 'METEOR_TOKEN',  // Name of an environment variable to check for a good token
                           // If a token is found and is good, authentication will require no
                           // user interaction.
     method: 'email'       // Login method: email or username
     retry: 5              // Number of login attempts to make
	},
  function (error, token) {
    if (error) {
      // Something went wrong...
    } else {
      // We are now logged in, with token as our session resume authToken...
    }
  }
);

From the command shell

Here's how to securely set an environment variable with an authentication token that can be used by other programs to avoid a user having to repeatedly enter credentials at the shell.

export METEOR_TOKEN=$(ddp-login --host 127.0.0.1 --port 3000 --env METEOR_TOKEN --method email)

The above will only work if ddp-login was installed with the npm -g option, or if it is run directly using node.js.

Keywords

FAQs

Package last updated on 31 May 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