ep_current_user
v1.0.1
Published
Exposes the current logged-in Etherpad user as JSON (a whoami endpoint). Lets your own external site or app find out who is signed in, based on the login session — works with auth plugins such as ep_openid_connect. Also exports getUser() for other plugins
Maintainers
Readme
ep_current_user
Exposes the current logged-in Etherpad user as JSON — a small whoami
endpoint. Your own external site, landing page or app can call it to find out
who is signed in, instead of poking around the database or the login session
yourself.
It reads the user from the request session, which is populated by auth plugins
such as ep_openid_connect.
Endpoint
Default URL is /whoami (configurable).
GET /whoami
{ "displayName": "Ivan Forkaliuk", "sub": "[email protected]" }Returns 404 when nobody is logged in.
Why this exists
Etherpad's official /api/1/... is a stateless, apikey-based admin API — it
never sees the browser session, so it cannot tell you who is logged in. This
plugin runs inside Etherpad and reads the session directly, so external apps
don't need any database access to answer that question.
For other plugins
The data layer is exported so other plugins can reuse it in-process:
const { getUser } = require('ep_current_user/lib/user');
const user = getUser(req); // { displayName, sub } or nullConfiguration
Optional. In settings.json:
"ep_current_user": {
"path": "/whoami"
}| Option | Default | Meaning |
|--------|------------|----------------------|
| path | /whoami | URL of the endpoint. |
Requirements
- Etherpad (
ep_etherpad-lite). - An authentication method that populates the login session — e.g.
requireAuthenticationtogether withep_openid_connect. Without it there is no logged-in user, so/whoamihas nobody to report.
Install
cd /path/to/etherpad
pnpm run plugins i ep_current_userLicense: Apache-2.0.
