/api/auth/feishuStart a Feishu sign-in
Redirects to the Feishu authorisation page with the application id and the configured redirect URI. The user leaves the studio here and comes back on the callback route.
Authentication for DK Studio, served as a standalone service. It signs a user in through Feishu or through your SSO provider and hands the session back to the Studio. The Studio does not depend on it, and it holds no test data of its own.
Four routes, all of them a redirect in or out. Two start a sign-in, two receive the provider's answer.
/api/auth/feishuRedirects to the Feishu authorisation page with the application id and the configured redirect URI. The user leaves the studio here and comes back on the callback route.
/api/auth/ssoRedirects to the SSO provider with the client id, requesting the openid, profile and email scopes. The user returns on the SSO callback route.
/api/auth/feishu/callbackHandles the provider's answer: exchanges the authorisation code, establishes the session, and sends the user on to the Studio.
/api/auth/sso/callbackThe same exchange for the SSO provider. Both callbacks read the code from the query string and refuse a request that arrives without one.
The service never holds a password. It sends the user to the provider, and the provider comes back with a code.
The Studio opens the Feishu or SSO authorisation route in the user's browser.
The user is redirected to the provider with the client id, the redirect URI and the scopes the service needs.
The provider calls the matching callback route with an authorisation code.
The code is exchanged, the session is created, and the user lands back in the Studio.
Six environment variables, read from the environment the service runs in. Put them in .env.local. .env.local
| Variable | Default | Meaning |
|---|---|---|
FEISHU_APP_ID | β | The Feishu application id. The Feishu authorisation route refuses to start without it. |
FEISHU_REDIRECT_URI | http://localhost:3003/api/auth/feishu/callback | Where Feishu sends the user back. |
SSO_CLIENT_ID | β | The client id issued by the SSO provider. The SSO authorisation route refuses to start without it. |
SSO_URL | https://sso.ingeek.com | The SSO provider. |
SSO_REDIRECT_URI | http://localhost:3003/api/auth/sso/callback | Where the SSO provider sends the user back. |
WEB_URL | http://localhost:3000 | Where the user is sent after a successful sign-in. |
The service runs on port 3003 in both development and production.
pnpm --filter api dev # http://localhost:3003
pnpm --filter api build
pnpm --filter api start # serves the build on http://localhost:3003