egg-xauth
v1.0.8
Published
Authing plugin for egg
Downloads
1
Maintainers
Readme
egg-authing
Install
$ npm i egg-authing --save
Usage
To enable Authing plugin, you should change ${baseDir}/config/plugin.js
// {app_root}/config/plugin.js
exports.authing = {
enable: true,
package: 'egg-authing',
};
Configuration
Single Instance
// {app_root}/config/config.default.js
exports.authing = {
client: {
clientId: '',
secret: ''
}
};
Multiple Instances
// {app_root}/config/config.default.js
exports.authing = {
clients: {
pool1:{
clientId: 'your_client_id',
secret: 'your_client_secret'
},
pool2: {
clientId: 'your_client_id',
secret: 'your_client_secret'
}
}
};
see config/config.default.js for more detail.
Example
const { ctx } = this;
const user = await ctx.authing.login({
email: '[email protected]',
password: 'testpassword'
});
//Multiple instances example
const { ctx } = this;
const userPool1 = await ctx.authing.get('pool1').login({
email: '[email protected]',
password: 'testpassword'
});
const userPool2 = await ctx.authing.get('pool2').login({
email: '[email protected]',
password: 'testpassword'
});
Questions & Suggestions
Please open an issue here.