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

passport-wiz

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-wiz - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

32

lib/strategy.js
// Load modules.
var OAuth2Strategy = require('passport-oauth2')
, util = require('util')
, urllib = require('urllib')

@@ -21,2 +22,18 @@ function Strategy(options, verify) {

this._oauth2.getOAuthAccessToken = function(code, params, callback) {
urllib.request(this._getAccessTokenUrl(), {
dataType: 'json',
contentType: 'json',
data: {
code: code,
client_id: this._clientId,
client_secret: this._clientSecret
},
method: 'POST'
}, function (err, body) {
if (err) return callback(err)
if (body.errno) return callback(new Error('obtain access_token failed'))
callback(null, body.data.access_token, null, body.data)
})
}
}

@@ -29,5 +46,14 @@

Strategy.prototype.userProfile = function(accessToken, done) {
var self = this;
this._oauth2.get(this._userProfileURL, accessToken, function (err, body, res) {
done(err, body.data)
this._oauth2._request("GET", this._userProfileURL, {
'Content-Type': 'application/json',
'Wiz-Access-Token': accessToken
}, null, null, function (err, body) {
if (err) return done(err)
try {
var body = JSON.parse(body)
if (body.errno) return done(new Error('fetch user profile failed'))
done(null, body.data)
} catch (e) {
done(e)
}
})

@@ -34,0 +60,0 @@ }

5

package.json
{
"name": "passport-wiz",
"version": "1.0.0",
"version": "1.0.1",
"description": "Wiz authentication strategy for Passport.",

@@ -33,3 +33,4 @@ "keywords": [

"dependencies": {
"passport-oauth2": "1.x.x"
"passport-oauth2": "1.x.x",
"urllib": "^2.16.0"
},

@@ -36,0 +37,0 @@ "engines": {

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