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

auth0

Package Overview
Dependencies
Maintainers
1
Versions
156
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auth0 - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

23

lib/api.js

@@ -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({

2

package.json
{
"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 @@

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