npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

geovis-sso-sdk

v2.1.13

Published

Geovis统一登录,可自动检测SSO登录状态,并实现账号同步登录和同步注销,支持弹窗和页面两种方式登录

Readme

geovis sso sdk 介绍

Geovis统一登录,可自动检测SSO登录状态,并实现账号同步登录和同步注销, 提供了重定向和弹窗两种登录方式

https://www.npmjs.com/package/geovis-sso-sdk


## install

```bash
npm install geovis-sso-sdk

快速开始

import { SSO, SSOOption } from 'geovis-sso-sdk';

// 初始化配置
const host = "https://sso.geovis.com";
const appKey = "YOUR_APP_KEY";

const ssoOption = new SSOOption(host, appKey, null, null);
const sso = new SSO(ssoOption);

// 初始化检测
sso.auth();

// 监听认证事件
sso.on('auth', (authData) => {
  if (authData.suceess) {
    # 登录成功业务处理
  } else {
    # 登录失败业务处理
  }
});


# 重定向登录示例代码
```bash
_sso.loginWithRedirect({
    redirectUrl: redirectUrl, #重定向地址,登录成功后回跳会把token字段拼接在url上
    openInNewTab #是否新标签页打开, 不传默认false
})


# 使用弹窗登录示例代码
```bash
_sso.loginWithDialog({
   # 登录成功
    onSuccess: (resData: SSOResponse<UserInfo>) => {
       # 登录成功的业务处理
    },
    # 登录失败
    onFail: (errRes: ssoErrorResponse) => {
     # 登录失败的业务处理
    },
   # 关闭弹窗
    onClose: () => {
     # 关闭弹窗的业务处理
    }
})

# 登出
```bash
_sso.logout()


# 注册事件监听
```bash
_sso.on('auth', (authData) => {
    # 登录成功业务处理
 })
 _sso.on('login', () => {
 # 登录钩子函数
 })
 _sso.on('logout', () => {
 # 登出钩子函数
 })
```

# 检查登录状态,在需要判断当前用户是否登录时调用
```bash
_sso.auth()

#  在业务方登录成功后,同步token给sso(不推荐使用,推荐去SSO登录)
_sso.login()

#  sso登出,如在点击登出按钮时调用
_sso.logout()

#  跳转SSO登录页面去登录
_sso.loginWithRedirect({
    redirectUrl: xxx, # 重定向地址,登录成功后回跳会把token字段拼接在url上
    openInNewTab: true/false, # 是否新标签页打开,不传默认false
})

#  打开登录弹窗进行登录
_sso.loginWithDialog({
    onSuccess: () => {
     #  登录成功回调函数
     ...
    },
    onFail: () => {
    # 登录失败回调函数
     ...
    },
    onClose: () => {
     # 关闭弹窗的回调
    }
})
```

```
如果在nodejs(nestjs)下使用,请导入sso-node.ts

```