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

@xpert-ai/plugin-lark-sso

v0.0.2

Published

Readme

Lark SSO Plugin

@xpert-ai/plugin-lark-sso provides Feishu/Lark account binding and SSO flows:

  • bind a logged-in Xpert user to a Feishu identity
  • sign in through Feishu SSO by resolving that binding first

This plugin is intended to run as a system plugin. Configure it once at the host level, then expose its SSO provider on the Xpert login page for the tenants that should use it.

Why union_id

union_id is the primary binding key because it is the stable cross-app identity within one Feishu developer ownership. This matches the current deployment assumption: one Xpert tenant serves one fixed Feishu developer ownership.

open_id is still collected, but only stored inside the binding profile. It is not used as the primary binding key because it is app-scoped and can change across apps.

Plugin Config

  • appId: Feishu app id used only by this SSO plugin
  • appSecret: Feishu app secret used for OAuth and JWT state signing
  • publicBaseUrl: optional public origin used for callback URL generation and same-origin returnTo validation

Routes

  • GET /api/lark-identity/bind/start
    • requires the current Xpert user to be logged in
    • starts Feishu OAuth and redirects to the host-side current-user confirmation page on callback
  • GET /api/lark-identity/login/start
    • accepts tenantId, optional organizationId, optional returnTo
    • starts Feishu OAuth and signs in only if a binding already exists in the current tenant
  • GET /api/lark-identity/callback
    • completes bind or login based on the signed JWT state and then redirects back into the host auth flow

Bind Flow

  1. Call /api/lark-identity/bind/start.
  2. The plugin signs a 10-minute JWT state with HS256 and redirects to Feishu OAuth.
  3. On callback, the plugin fetches Feishu profile data, requires union_id, and creates a pending binding ticket with flow current_user_confirm.
  4. The callback redirects to /auth/sso-confirm?ticket=... so the logged-in Xpert user can confirm the binding inside the host UI.

Login Flow

  1. Call /api/lark-identity/login/start?tenantId=....
  2. The plugin signs the tenant-scoped JWT state and redirects to Feishu OAuth.
  3. On callback, the plugin fetches Feishu profile data and asks the host to log in through the bound identity capability.
  4. If a bound user exists, the host returns Xpert login tokens and the plugin redirects to /sign-in/success?....
  5. If no binding exists, the plugin creates a pending binding ticket and redirects to /auth/sso-bind?ticket=....
  6. It never auto-provisions a user and it does not fall back to legacy login behavior.

returnTo Rules

Only these returnTo values are accepted:

  • root-relative paths such as /settings/account
  • absolute URLs whose origin matches publicBaseUrl

Anything else is rejected to prevent open redirects.

Scope

This plugin only owns Feishu identity binding and SSO sign-in entry points. It does not change legacy @xpert-ai/plugin-lark inbound identity resolution by itself.