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

casdoor-uniapp-sdk-t

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

casdoor-uniapp-sdk-t

uni-app client SDK for Casdoor

  • 1.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

casdoor-uniapp-sdk

NPM version NPM download codebeat badge GitHub Actions GitHub Actions Coverage Status Release Gitter

This 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

# 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)MustDescription
serverUrlYesyour Casdoor server URL
clientIdYesthe Client ID of your Casdoor application
appNameYesthe name of your Casdoor application
organizationNameYesthe name of the Casdoor organization connected with your Casdoor application
redirectPathNothe path of the redirect URL for your Casdoor application, will be /callback if not provided

Guide

For uniapp-vue3:

// 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:

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

// in pages/index/index.vue
<script>
export default {
 methods:{
  login(){				
   uni.navigateTo({
    url: `./webpage?path=${this.getSigninUrl()}`
   })
  }
 }
}
</script>

FAQs

Package last updated on 15 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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