Comparing version 0.0.3 to 0.0.4
@@ -82,2 +82,24 @@ var request = require('request'); | ||
Client.prototype.getConnectionByName = function(name, done) { | ||
var self = this; | ||
this._getAccessToken(function (err, accessToken) { | ||
if (err) return done(err); | ||
request.get({ | ||
url: self.apiUrl + '/connections', | ||
qs: { access_token: accessToken, name: name } | ||
}, function (err, r, body) { | ||
if (err) return done(err); | ||
if (r.statusCode === 404) return done( null, null); | ||
if (r.statusCode.toString().substr(0, 1) !== '2') return done(new Error(body)); | ||
try { | ||
var json = JSON.parse(body); | ||
done(null, json); | ||
} catch(e) { | ||
done(e); | ||
} | ||
}); | ||
}); | ||
}; | ||
Client.prototype.createConnection = function (connection, done) { | ||
@@ -95,3 +117,3 @@ var self = this; | ||
if(r.statusCode === 400) { | ||
return done(new Error(body.detail)); | ||
return done(new Error(body.detail || body)); | ||
} | ||
@@ -103,2 +125,21 @@ done(null, body); | ||
Client.prototype.updateConnection = function (connection, done) { | ||
var self = this; | ||
this._getAccessToken(function (err, accessToken) { | ||
if (err) return done(err); | ||
request.put({ | ||
url: self.apiUrl + '/connections/' + connection._id, | ||
qs: { access_token: accessToken }, | ||
json: connection | ||
}, function (err, r, body) { | ||
if (err) { return done(err); } | ||
if(r.statusCode === 400) { | ||
return done(new Error(body.detail || body)); | ||
} | ||
done(null, body); | ||
}); | ||
}); | ||
}; | ||
module.exports = Client; |
{ | ||
"name": "auth0", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Client library for the Auth0 platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -35,32 +35,7 @@ Node.js client library for the Auth0 platform. | ||
"client_secret": "aadsadsadsa", | ||
"email": true, | ||
"profile": true, | ||
"contacts": false, | ||
"blogger": false, | ||
"calendar": false, | ||
"gmail": false, | ||
"google_plus": false, | ||
"orkut": false, | ||
"picasa_web": false, | ||
"tasks": false, | ||
"youtube": false, | ||
"adsense_management": false, | ||
"google_affiliate_network": false, | ||
"analytics": false, | ||
"google_books": false, | ||
"google_cloud_storage": false, | ||
"content_api_for_shopping": false, | ||
"chrome_web_store": false, | ||
"document_list": false, | ||
"google_drive": false, | ||
"google_drive_files": false, | ||
"latitude_best": false, | ||
"latitude_city": false, | ||
"moderator": false, | ||
"sites": false, | ||
"spreadsheets": false, | ||
"url_shortener": false, | ||
"webmaster_tools": false | ||
}, | ||
"status": 0 | ||
"sites": true, | ||
"spreadsheets": true, | ||
"url_shortener": true, | ||
"webmaster_tools": true | ||
} | ||
}; | ||
@@ -67,0 +42,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4947
123
53