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

fuel-auth

Package Overview
Dependencies
Maintainers
3
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fuel-auth

Node Library for Authenticating with ExactTarget Fuel. Used for authenticating REST and SOAP APIs.

  • 0.5.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.5K
decreased by-55.97%
Maintainers
3
Weekly downloads
 
Created
Source

Fuel Auth (for Node.js) Build Status

This library allows users to create authentication clients for ExactTarget APIs.

Use our REST and SOAP clients to interact with these APIs at a low-level.

This library is compatible with node versions 0.8 and 0.10+. npm install will error if you're using node version 0.8 with developer dependencies. To have a successful install for testing/contributing use npm install -g npm@1.2.8000 and the issue should be resolved.

Accessing ExactTarget's API

This is a new library and requires extensive testing. Feel free to test it out and submit issues as they are found.

npm install fuel-auth --save

Initialization

new FuelAuth( options )

  • options
    • required: yes
    • Type: Object

API

  1. getAccessToken( options, callback )
    • options
    • options.force
      • required: no
      • Type: Boolean
      • default: false
      • If true, token will always be requested from API regardless of expiration
    • callback( error, data )
      • required: yes
      • Type: Function
      • Function that will be executed after token request completes
      • parameters
        • error - error encountered. null if no error
        • data - object with data and response
          • accessToken ( data.accessToken ) - access token
          • expiresIn ( data.expiresIn ) - time until token expiration
  2. checkExpired()
    • Returns boolean value. true if token is not expired and it exists. false if token is expired or it doesn't exist.

Setting up the client

var FuelAuth = require( 'fuel-auth' );

// Required Settings
var myClientId     = 'yourClientId';
var myClientSecret = 'yourClientSecret';

// Minimal Initialization
var FuelAuthClient = new FuelAuth({
	clientId: myClientId // required
	, clientSecret: myClientSecret // required
});

// Initialization with extra options
var authUrl      = "https://auth.exacttargetapis.com/v1/requestToken"; //this is the default
var accessToken  = "";
var refreshToken = "";

var FuelAuthClient = new FuelAuth({
	clientId: myClientId // required
	, clientSecret: myClientSecret // required
	, authUrl: authUrl
	, accessToken: accessToken
	, refreshToken: refreshToken
});

Examples

var options = {
	// whatever request options you want
	// See https://github.com/mikeal/request#requestoptions-callback

	// I want to force a request
	force: true
};

FuelAuthClient.getAccessToken( options, function( err, data ) {
	if( !!err ) {
		console.log( err );
		return;
	}

	// data.accessToken = your token
	// data.expiresIn = how long until token expiration
	console.log( data );
});

// OR don't pass any options
FuelAuthClient.getAccessToken( function( err, data ) {
	if( !!err ) {
		console.log( err );
		return;
	}

	// data.accessToken = your token
	// data.expiresIn = how long until token expiration
	console.log( data );
});

Contributors

In alphabetical order

Contributing

We welcome all contributions and issues! There's only one way to make this better, and that's by using it. If you would like to contribute, please checkout our guidelines!

ChangeLog

  • 0.5.2 - 2014-10-16 - added easier way to use scope option when requesting token
  • 0.5.1 - 2014-08-19 - fixed Travis CI testing for 0.8 and 0.10
  • 0.5.0 - 2014-08-06 - updated request dependency version due to qs module security vulnerability
  • 0.4.0 - 2014-08-06 - removed event emitter - breaking
  • 0.3.0 - 2014-08-05 - getAccessToken API change - breaking
  • 0.2.1 - 2014-08-05
    • completed unit tests
    • npm package update
    • changing require name to fuel-auth
    • added license
    • readme update
  • 0.2.0 - 2014-06-25
    • refactored object constructor
    • removed context from getAccessToken API
    • docs/readme updates
  • 0.1.1 - 2014-06-23 - readme updates
  • 0.1.0 - 2014-06-23
    • adding callbacks to getAccessToken API
    • adding ability to pass extra request options to getAccessToken API
    • adding ability to force token request from ExactTarget API
    • adding check for expired token
  • 0.0.1 - 2014-06-22
    • added event emitter for delivery of data
    • setup travis
    • refactoring of unit tests
    • semantic changes
    • initial commits

FAQs

Package last updated on 09 Mar 2015

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