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

passport-cognito

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-cognito - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

test/bootstrap/node.js

21

lib/strategy.js
// Load modules.
var AWS = require('aws-sdk');
var util = require('util');
var Strategy = require('passport-strategy').Strategy;
var passport = require('passport-strategy');

@@ -51,7 +51,7 @@ var AuthenticationDetails = require('./cognito/AuthenticationDetails');

if (!options) throw new Error('Cognito strategy requires options');
if (!verify) throw new Error('Cognito strategy requires a verify function');
if (!verify) throw new Error('Cognito strategy requires a verify callback');
AWS.config.region = 'ap-northeast-1';
Strategy.call(this);
passport.Strategy.call(this);
this.name = 'cognito';

@@ -61,2 +61,5 @@ this._userPoolId = options.userPoolId;

this._verify = verify;
this.accessToken;
this.idToken;
this.refreshToken;
}

@@ -66,3 +69,3 @@

// Inherit from `passport-strategy`.
util.inherits(CognitoStrategy, Strategy);
util.inherits(CognitoStrategy, passport.Strategy);

@@ -91,3 +94,2 @@

var self = this;

@@ -103,6 +105,7 @@

onSuccess: function (result) {
accessToken = result.getAccessToken().getJwtToken();
idToken = result.getIdToken().getJwtToken();
refreshToken = result.getRefreshToken().getToken();
self.accessToken = result.getAccessToken().getJwtToken();
self.idToken = result.getIdToken().getJwtToken();
self.refreshToken = result.getRefreshToken().getToken();
if (!accessToken || !idToken) {

@@ -114,3 +117,3 @@ return self.fail({ message: options.badRequestMessage || 'Missing token' }, 400);

try {
self._verify(accessToken, idToken, refreshToken, profile, verified);
self._verify(self.accessToken, self.idToken, self.refreshToken, profile, verified);
} catch (ex) {

@@ -117,0 +120,0 @@ return self.error(ex);

{
"name": "passport-cognito",
"version": "0.1.2",
"version": "0.1.3",
"description": "Express passport module for Cognito User Pools",
"main": "./lib/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha --require test/bootstrap/node test/*.test.js --timeout 10000"
},

@@ -34,3 +34,9 @@ "repository": {

"util": "^0.10.3"
},
"devDependencies": {
"assert": "^1.4.1",
"chai": "^3.5.0",
"chai-passport-strategy": "^1.0.0",
"mocha": "^3.1.2"
}
}

@@ -18,3 +18,3 @@ # passport-cognito

### Confiture Strategy
### Configure Strategy

@@ -29,3 +29,3 @@ ```javascript

},
function(accessToken, refreshToken, profile, cb) {
function(accessToken, idToken, refreshToken, profile, cb) {
process.nextTick(function() {

@@ -40,3 +40,3 @@ ...

### Authenticate Requests
To authenticate a user, send username and password by POST request like the following.
To authenticate a user, send username and password to serser-side by POST request like the following.

@@ -43,0 +43,0 @@ ```javascript

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