casdoor-vue-sdk-test
v0.0.3
Published
Vue client SDK for Casdoor
Downloads
4
Maintainers
Readme
casdoor-vue-sdk
This is Casdoor's SDK for js will allow you to easily connect your application to the Casdoor authentication system without having to implement it from scratch.
Casdoor SDK is very simple to use. We will show you the steps below.
Noted that this sdk has been applied to casnode, if you still don’t know how to use it after reading README.md, you can refer to it
Installation
# NPM
npm i casdoor-vue-sdk
# Yarn
yarn add casdoor-vue-sdk
Init SDK
Initialization requires 5 parameters, which are all string type:
| Name (in order) | Must | Description |
| ---------------- | ---- | --------------------------------------------------- |
| serverUrl | Yes | your Casdoor server URL |
| clientId | Yes | the Client ID of your Casdoor application |
| appName | Yes | the name of your Casdoor application |
| organizationName | Yes | the name of the Casdoor organization connected with your Casdoor application |
| redirectPath | No | the path of the redirect URL for your Casdoor application, will be /callback
if not provided |
install:
// in main.js
import Casdoor from 'casdoor-vue-sdk'
const config = {
serverUrl: "http://localhost:7001",
clientId: "288fdc8522f360207141",
organizationName: "casbin-forum",
appName: "forum",
redirectPath: "/callback",
};
const app = createApp(App)
app.use(Casdoor, config)
example:
// in app.vue
<script>
export default {
name: 'App',
methods: {
login() {
window.location.href = this.getSigninUrl();
},
signup() {
window.location.href = this.getSignupUrl();
}
}
}
</script>
For developer:
use command webpack
in the root directory to build the sdk