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

@aoberoi/passport-slack

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

@aoberoi/passport-slack - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

48

dist/strategy.js

@@ -6,4 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const https_1 = require("https");
const querystring_1 = require("querystring");
const passport_oauth2_1 = __importDefault(require("passport-oauth2")); // tslint:disable-line:import-name
const needle_1 = __importDefault(require("needle"));
const object_entries_1 = __importDefault(require("object.entries"));

@@ -65,16 +66,37 @@ /**

userProfile(accessToken, done) {
needle_1.default('get', this.slack.profileURL, { token: accessToken })
.then(({ body }) => {
if (!body.ok) {
// Check for an error related to the X-Slack-User header missing
if (body.error === 'user_not_specified') {
done(null, undefined);
let handled = false;
const handle = (error, profile) => {
if (!handled) {
handled = true;
done(error, profile);
}
};
const req = https_1.get(`${this.slack.profileURL}?${querystring_1.stringify({ token: accessToken })}`, (res) => {
let body = '';
if (res.statusCode !== 200) {
handle(new Error(res.statusMessage));
}
res.setEncoding('utf8');
res.on('data', chunk => body += chunk);
res.on('end', () => {
try {
body = JSON.parse(body);
}
else {
throw new Error(body.error);
catch (error) {
handle(error);
}
}
done(null, body);
})
.catch(done);
if (!body.ok) {
// Check for an error related to the X-Slack-User header missing
if (body.error === 'user_not_specified') {
handle(null, undefined);
}
else {
handle(new Error(body.error));
}
}
handle(null, body);
});
res.on('error', handle);
});
req.on('error', handle);
}

@@ -81,0 +103,0 @@ /**

{
"name": "@aoberoi/passport-slack",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"description": "Slack authentication strategy for Passport",

@@ -24,5 +24,3 @@ "main": "dist/strategy.js",

"@types/express": "^4.16.0",
"@types/needle": "^2.0.2",
"@types/passport-oauth2": "^1.4.5",
"needle": "^2.2.3",
"object.entries": "^1.0.4",

@@ -29,0 +27,0 @@ "passport-oauth2": "^1.4.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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