@cubetool/plugin-auth
v1.0.2
Published
cube 用户认证插件
Downloads
16
Keywords
Readme
cube 用户认证插件
开发者工具用户认证插件,提供本地用户登录、退出功能。
插件功能
可在其他插件中触发相关 events 获取用户认证信息。
EVENT: login
登录,使用示例:
const authPluginInstalled = ctx.emit('@cubetool/plugin-auth:login', async (getToken) => {
const token = await getToken();
});
if(!authPluginInstalled){
// 提示安装此插件或自行实现用户认证
}
EVENT: logout
退出登录,使用示例:
ctx.emit('@cubetool/plugin-auth:logout');
EVENT: auth
授权,使用示例:
ctx.emit('@cubetool/plugin-auth:auth', token);
CLI 命令
为 @cubetool/cli 拓展以下子命令:
cubetool login
登录。
cubetool logout
退出。