New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

casdoor-js-sdk

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

casdoor-js-sdk - npm Package Compare versions

Comparing version 0.2.7 to 0.3.0

1

lib/cjs/sdk.js

@@ -25,2 +25,3 @@ "use strict";

if (enablePassword) {
sessionStorage.setItem("signinUrl", this.getSigninUrl());
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;

@@ -27,0 +28,0 @@ }

@@ -23,2 +23,3 @@ // Copyright 2021 The casbin Authors. All Rights Reserved.

if (enablePassword) {
sessionStorage.setItem("signinUrl", this.getSigninUrl());
return `${this.config.serverUrl.trim()}/signup/${this.config.appName}`;

@@ -25,0 +26,0 @@ }

2

package.json
{
"name": "casdoor-js-sdk",
"version": "0.2.7",
"version": "0.3.0",
"description": "Javascript client SDK for Casdoor",

@@ -5,0 +5,0 @@ "main": "lib/cjs/index.js",

@@ -24,5 +24,5 @@ # casdoor-js-sdk

> 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
## Usage in NPM environment
## Installation
### Installation

@@ -37,3 +37,3 @@ ~~~shell script

## Init SDK
### Init SDK

@@ -63,1 +63,85 @@ Initialization requires 5 parameters, which are all string type:

```
## Usage in vanilla Javascript
### Import and init SDK
Initialization parameters are consistent with the previous node.js section:
```html
<!--init the SDK-->
<script type="module">
//Import from cdn(you can choose the appropriate cdn source according to your needs), or just from the local(download the casdoor-js-sdk first)
import SDK from 'https://unpkg.com/casdoor-js-sdk@latest/lib/esm/sdk.js'
const sdkConfig = {
serverUrl: "https://door.casbin.com",
clientId: "014ae4bd048734ca2dea",
appName: "app-casnode",
organizationName: "casbin",
redirectPath: "/callback",
}
window.sdk = new SDK(sdkConfig)
</script>
```
### Call functions in SDK
```html
<script type="text/javascript">
function gotoSignUpPage() {
window.location.href = sdk.getSigninUrl()
}
</script>
```
## API reference interface
#### Get sign up url
```typescript
getSignupUrl(enablePassword)
```
Return the casdoor url that navigates to the registration screen
#### Get sign in url
```typescript
getSigninUrl()
```
Return the casdoor url that navigates to the login screen
#### Get user profile page url
```typescript
getUserProfileUrl(userName, account)
```
Return the url to navigate to a specific user's casdoor personal page
#### Get my profile page url
```typescript
getMyProfileUrl(account)
```
#### Sign in
```typescript
signin(serverUrl)
```
Handle the callback url from casdoor, call the back-end api to complete the login process
## More examples
To see how to use casdoor frontend SDK with casdoor backend SDK, you can refer to examples below:
[casnode](https://github.com/casbin/casnode): casdoor-js-sdk + casdoor-go-sdk
[casdoor-python-vue-sdk-example](https://github.com/casdoor/casdoor-python-vue-sdk-example): casdoor-vue-sdk + casdoor-python-sdk
A more detailed description can be moved to:[casdoor-sdk](https://casdoor.org/docs/how-to-connect/sdk)
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