Comparing version 0.1.2 to 0.1.3
@@ -106,2 +106,25 @@ var request = require('request'), | ||
api.updateTemplate = function (accessToken, strategy, options, done) { | ||
request.put({ | ||
url: this.apiUrl + '/connection-templates/' + strategy, | ||
qs: { access_token: accessToken }, | ||
json: options | ||
}, function (err, r, body) { | ||
if (err) return done(err); | ||
if (r.statusCode.toString().substr(0, 1) !== '2') return done(new Error(body)); | ||
done(); | ||
}); | ||
}; | ||
api.getTemplate = function (accessToken, strategy, done) { | ||
request.get({ | ||
url: this.apiUrl + '/connection-templates/' + strategy, | ||
qs: { access_token: accessToken } | ||
}, function (err, r, body) { | ||
if (err) return done(err); | ||
if (r.statusCode.toString().substr(0, 1) !== '2') return done(new Error(body)); | ||
done(null, JSON.parse(body)); | ||
}); | ||
}; | ||
api.getConnection = function(accessToken, name, done) { | ||
@@ -108,0 +131,0 @@ request.get({ |
{ | ||
"name": "auth0", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Client library for the Auth0 platform", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -9,2 +9,4 @@ Node.js client library for the Auth0 platform. | ||
Initialice your client class with the credentials in the [settings section](https://app.auth0.com/#/settings) of the dashboard. | ||
~~~js | ||
@@ -14,5 +16,5 @@ var Auth0 = require('auth0'); | ||
var client = new Auth0({ | ||
domain: 'yourdomain.auth0.com', | ||
clientID: 'your-client-id', | ||
clientSecret: 'your-client-secret', | ||
domain: '' | ||
clientSecret: 'your-client-secret' | ||
}); | ||
@@ -23,2 +25,4 @@ ~~~ | ||
Return a list of all the connections in your application: | ||
~~~js | ||
@@ -32,17 +36,30 @@ client.getConnections(function (err, connections){ | ||
Normally you will create what we call **enterprise connections** from your application. | ||
When a new customer sign up to your product, you will ask him for his **directory's** credentials. Then you will be able to create the connection by using our API or in this case this client library: | ||
~~~js | ||
var myNewConnection = { | ||
"name": "a-new-connection", | ||
"strategy": "google-oauth2", | ||
"options": { | ||
"client_id": "aaa", | ||
"client_secret": "aadsadsadsa", | ||
"sites": true, | ||
"spreadsheets": true, | ||
"url_shortener": true, | ||
"webmaster_tools": true | ||
} | ||
}; | ||
//a friendly name to identify the connection | ||
'name': 'thesuperstore-connection', | ||
client.createConnection(myNewConnection, function (err) { | ||
//this is the strategy: office365, google-apps, adfs | ||
'strategy': 'office365', | ||
'options': { | ||
// these are the credentials of your application in the provider | ||
'app_domain': 'your-app-domain.com', | ||
'client_id': 'xxx', | ||
'client_secret': 'xxx', | ||
// this field is provided by the user when he registers: | ||
'tenant_domain': 'your tenants domain', | ||
// these are the grants you want: | ||
'user_id': true, | ||
'email': true, | ||
'ext_profile': true | ||
}; | ||
client.createConnection(myNewConnection, function (err, connection) { | ||
//..... | ||
@@ -52,2 +69,5 @@ }); | ||
The returned connection will have a ```provisioning_ticket_url``` field to which you have to redirect the client in order to complete the authorization process. | ||
### client.getUsers({[connection: connection], [per_page: 10]}, callback) | ||
@@ -54,0 +74,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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10107
196
104
0