lds-connect-proxy

A node.js service to to proxy the ldsconnect.org API

You might be in the wrong place

You probably want to use https://github.com/LDSorg/lds-connect-demo-angular-node.

I just separated this module for the fun of it. You can use it on its own, but I didn't expect that anyone would.

lds-connect-proxy-node

This proxy's the lds-connect API in your app so that your front-end javascript (and, in particular, angular-lds-connect) can make calls to ldsconnect.org.

In the future, when ldsconnect.org supports CORS (and employs the proper security measures), this module will not be necessary.

Questions? Comments? Leave an issue or join the discussion on Google Groups

Install

npm install --save passport-lds-connect
npm install --save lds-connect-proxy

Usage

server.js:

var ldsConnectProxy
  ;
  
function getAccessTokenFromSession(req) {
  // flavor to the way you handle sessions in your app 
  return req.user && req.user.accessToken;
}
function getUserIdFromSession(req) {
  return req.user && req.user.ldsId;
}
 
ldsConnectProxy = require('lds-connect-proxy').create(getAccessTokenFromSession, getUserIdFromSession);
 
// Express 
ldsConnectProxy(app);
 
// Connect 
// if (!connect.router) { connect.router = require('connect_router'); } 
// app.use(connect.router(ldsConnectProxy)); 

In order to get an access token in the first place you will need to use passport-lds-connect. See https://github.com/LDSorg/lds-connect-demo-angular-node for example usage.