New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-authenticators

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-authenticators - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

lib/vendors/ZaloAuthenticator.d.ts

3

lib/index.d.ts

@@ -11,4 +11,5 @@ import FacebookAuthenticator from './vendors/FacebookAuthenticator';

import LineAuthenticator from './vendors/LineAuthenticator';
import ZaloAuthenticator from './vendors/ZaloAuthenticator';
import OAuth from './oauth/OAuth';
import OAuth2 from './oauth2/OAuth2';
export { FacebookAuthenticator, FoursquareAuthenticator, GithubAuthenticator, GoogleAuthenticator, InstagramAuthenticator, LinkedInAuthenticator, PinterestAuthenticator, TumblrAuthenticator, TwitterAuthenticator, LineAuthenticator, OAuth2, OAuth };
export { FacebookAuthenticator, FoursquareAuthenticator, GithubAuthenticator, GoogleAuthenticator, InstagramAuthenticator, LinkedInAuthenticator, PinterestAuthenticator, TumblrAuthenticator, TwitterAuthenticator, LineAuthenticator, ZaloAuthenticator, OAuth2, OAuth };

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.OAuth = exports.OAuth2 = exports.LineAuthenticator = exports.TwitterAuthenticator = exports.TumblrAuthenticator = exports.PinterestAuthenticator = exports.LinkedInAuthenticator = exports.InstagramAuthenticator = exports.GoogleAuthenticator = exports.GithubAuthenticator = exports.FoursquareAuthenticator = exports.FacebookAuthenticator = void 0;
exports.OAuth = exports.OAuth2 = exports.ZaloAuthenticator = exports.LineAuthenticator = exports.TwitterAuthenticator = exports.TumblrAuthenticator = exports.PinterestAuthenticator = exports.LinkedInAuthenticator = exports.InstagramAuthenticator = exports.GoogleAuthenticator = exports.GithubAuthenticator = exports.FoursquareAuthenticator = exports.FacebookAuthenticator = void 0;
const FacebookAuthenticator_1 = __importDefault(require("./vendors/FacebookAuthenticator"));

@@ -28,2 +28,4 @@ exports.FacebookAuthenticator = FacebookAuthenticator_1.default;

exports.LineAuthenticator = LineAuthenticator_1.default;
const ZaloAuthenticator_1 = __importDefault(require("./vendors/ZaloAuthenticator"));
exports.ZaloAuthenticator = ZaloAuthenticator_1.default;
const OAuth_1 = __importDefault(require("./oauth/OAuth"));

@@ -30,0 +32,0 @@ exports.OAuth = OAuth_1.default;

@@ -8,2 +8,3 @@ import { IOAuthCommon, IPopSession, IStoreSession } from '../OAuthCommon';

export default class OAuth2<T> implements IOAuthCommon<T> {
#private;
private config;

@@ -23,2 +24,4 @@ private options;

enablePKCE: boolean;
clientIDQueryName?: string;
secretHeaderName?: string;
});

@@ -25,0 +28,0 @@ callback({ pop }: IPopSession, rawQuery: string): Promise<T>;

@@ -30,5 +30,11 @@ "use strict";

};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _OAuth2_instances, _OAuth2_clientIDQueryName_get;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -46,2 +52,3 @@ // eslint-disable-next-line import/no-unresolved

this.options = options;
_OAuth2_instances.add(this);
}

@@ -69,3 +76,5 @@ callback({ pop }, rawQuery) {

const code = query.code;
const body = querystring_1.default.stringify(Object.assign(Object.assign(Object.assign({ client_id: this.config.clientID, redirect_uri: this.config.redirectUri, client_secret: this.config.clientSecret, code }, !this.options.ignoreGrantType && { grant_type: 'authorization_code' }), this.options.includeStateInAccessToken && { state }), this.options.enablePKCE && { code_verifier: verifier }));
const body = querystring_1.default.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ [__classPrivateFieldGet(this, _OAuth2_instances, "a", _OAuth2_clientIDQueryName_get)]: this.config.clientID, redirect_uri: this.config.redirectUri }, !this.options.secretHeaderName && {
client_secret: this.config.clientSecret
}), { code }), !this.options.ignoreGrantType && { grant_type: 'authorization_code' }), this.options.includeStateInAccessToken && { state }), this.options.enablePKCE && { code_verifier: verifier }));
const res = this.options.tokenRequestMethod === "GET" /* GET */

@@ -75,6 +84,5 @@ ? yield (0, node_fetch_1.default)(`${this.config.tokenURL}?${body}`)

method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json',
},
headers: Object.assign({ 'Content-Type': 'application/x-www-form-urlencoded', Accept: 'application/json' }, this.options.secretHeaderName && {
[this.options.secretHeaderName]: this.config.clientSecret
}),
body

@@ -109,3 +117,3 @@ });

return `${this.config.consentURL}?\
${querystring_1.default.stringify(Object.assign({ client_id: this.config.clientID, redirect_uri: this.config.redirectUri, state, scope: this.config.scope, response_type: 'code' }, this.options.enablePKCE && {
${querystring_1.default.stringify(Object.assign(Object.assign(Object.assign({ [__classPrivateFieldGet(this, _OAuth2_instances, "a", _OAuth2_clientIDQueryName_get)]: this.config.clientID, redirect_uri: this.config.redirectUri, state }, this.config.scope && { scope: this.config.scope }), { response_type: 'code' }), this.options.enablePKCE && {
code_challenge: crypto_1.default

@@ -125,1 +133,5 @@ .createHash('sha256')

exports.default = OAuth2;
_OAuth2_instances = new WeakSet(), _OAuth2_clientIDQueryName_get = function _OAuth2_clientIDQueryName_get() {
var _a;
return (_a = this.options.clientIDQueryName) !== null && _a !== void 0 ? _a : 'client_id';
};
{
"name": "express-authenticators",
"version": "0.1.0",
"version": "0.1.1",
"description": "Third party authenticators in nodejs. Support various providers. Zero heavy dependencies.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -41,3 +41,3 @@ # Express Authenticators [![Build Status](https://travis-ci.org/tranvansang/express-authenticators.svg?branch=master)](https://travis-ci.org/tranvansang/express-authenticators)

TwitterAuthenticator,
LineAuthenticator,
ZaloAuthenticator,
OAuth2,

@@ -79,3 +79,6 @@ OAuth

try {
const payload = await facebookAuth.callback(req.session.oauthFacebook, new URL(req.url).search)
const payload = await facebookAuth.callback(
req.session.oauthFacebook,
new URL(`https://example.com${req.url}`).search.replace(/^\?/, '')
)
const profile = await facebookAuth.fetchProfile(payload)

@@ -109,2 +112,3 @@ console.log('got profile', profile)

- `LineAuthenticator`
- `ZaloAuthenticator`

@@ -111,0 +115,0 @@ ## Constructors

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