Expand description
Feishu / Lark authentication plugin (feishu-auth).
Validates a Feishu authorization code by exchanging it, through Feishu’s
OAuth v2 token endpoint, for a user access token, then calls Feishu’s
userinfo endpoint to resolve the calling user’s identity and attaches it to
the request. A code that cannot be resolved is rejected with a 401.
§Ported subset / deviations from APISIX
APISIX’s feishu-auth is a session plugin: it caches the exchanged access
token and resolved userinfo in an encrypted feishu_session cookie so later
requests skip the callouts, and it 302-redirects to redirect_uri when no
code/session is present. featherbit is stateless with no session store, so
this port implements the token-validation subset: every request must
carry a code, which is exchanged and validated on each request. The session
/ cookie / redirect machinery is dropped, along with the keys that only
served it (secret, secret_fallbacks, redirect_uri, cookie_expires_in).
auth_redirect_uri is retained because it is part of the authorization_code
token-exchange body, not the interactive redirect.
Structs§
- Feishu
Auth Plugin - Authenticates requests by exchanging a Feishu authorization code for a user access token, then resolving that token to a Feishu user.
Enums§
- Feishu
Error 🔒 - Outcome of resolving a Feishu code. Every failure maps to a
401(FEISHU_AUTH_FAILED); variants exist to keep the reason legible.
Constants§
Functions§
- attach_
identity 🔒 - Copies the resolved identity into
context.messageand optionally theX-Userinforequest header. - parse_
access_ 🔒token - Parses the user access token from Feishu’s v2 token response.
- parse_
userinfo 🔒 - Parses Feishu’s userinfo response, returning
data.dataoncode == 0. - require_
string 🔒