Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/casdoor/casdoor-uniapp-sdk
uni-app SDK for Casdoor, see example at: https://github.com/casdoor/casdoor-uniapp-example
https://github.com/casdoor/casdoor-uniapp-sdk
auth authentication authn casdoor iam oauth oidc sso uni-app uniapp vue vuejs
Last synced: 3 months ago
JSON representation
uni-app SDK for Casdoor, see example at: https://github.com/casdoor/casdoor-uniapp-example
- Host: GitHub
- URL: https://github.com/casdoor/casdoor-uniapp-sdk
- Owner: casdoor
- License: apache-2.0
- Created: 2022-05-12T14:20:40.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-04T10:59:31.000Z (over 1 year ago)
- Last Synced: 2024-09-24T17:48:24.305Z (5 months ago)
- Topics: auth, authentication, authn, casdoor, iam, oauth, oidc, sso, uni-app, uniapp, vue, vuejs
- Language: JavaScript
- Homepage: https://github.com/casdoor/casdoor
- Size: 74.2 KB
- Stars: 1
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# casdoor-uniapp-sdk
[![NPM version][npm-image]][npm-url]
[![NPM download][download-image]][download-url]
[](https://codebeat.co/projects/github-com-casdoor-casdoor-uniapp-sdk-master)
[](https://github.com/casdoor/casdoor-uniapp-sdk/actions/workflows/release.yml)
[](https://github.com/casdoor/casdoor-uniapp-sdk/actions/workflows/build.yml)
[](https://codecov.io/gh/casdoor/casdoor-uniapp-sdk)
[](https://github.com/casdoor/casdoor-uniapp-sdk/releases/latest)
[](https://discord.gg/5rPsrAzK7S)[npm-image]: https://img.shields.io/npm/v/casdoor-uniapp-sdk.svg?style=flat-square
[npm-url]: https://npmjs.com/package/casdoor-uniapp-sdk
[download-image]: https://img.shields.io/npm/dm/casdoor-uniapp-sdk.svg?style=flat-square
[download-url]: https://npmjs.com/package/casdoor-uniapp-sdkThis is Casdoor's SDK for uniapp will allow you to easily connect your application to the Casdoor authentication system
without having to implement it from scratch.## Install
~~~shell script
# NPM
npm i casdoor-uniapp-sdk# Yarn
yarn add casdoor-uniapp-sdk
~~~## Parameters
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 |## Guide
### For uniapp-vue3:
```javascript
// in main.js
import App from './App'// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif// #ifdef VUE3
import { createSSRApp } from 'vue'
import Sdk from './casdoor-uniapp-sdk.js'
export function createApp() {
const app = createSSRApp(App)
app.use(Sdk, {
serverUrl: "https://door.casbin.com",
clientId: "014ae4bd048734ca2dea",
organizationName: "casbin",
appName: "app-casnode",
redirectPath: "/callback",
})
return {
app
}
}
// #endif
```### For uniapp-vue2:
```javascript
import App from './App'// #ifndef VUE3
import Vue from 'vue'
import Sdk from './casdoor-uniapp-sdk.js'
Vue.config.productionTip = false
Vue.use(Sdk, {
serverUrl: "https://door.casbin.com",
clientId: "014ae4bd048734ca2dea",
organizationName: "casbin",
appName: "app-casnode",
redirectPath: "/callback",
})
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
```## Example
```vue
// in pages/index/index.vueexport default {
methods:{
login(){
uni.navigateTo({
url: `./webpage?path=${this.getSigninUrl()}`
})
}
}
}```