Sign in with Sevnly
Let people sign in to your app with their Sevnly account, and, if they agree, use their planners.
Make an app on dev.sevnly.com and people can sign in to it with their Sevnly account. It’s standard OAuth 2.1 with OpenID Connect, so most sign-in libraries work with it. You can also ask for access to their planners: they see every permission on the consent screen and can untick the ones they don’t want.
Make an app
- Go to dev.sevnly.com and sign in.
- Choose New app. Give it a name, a short description, and your homepage, privacy policy and terms links. People see all of these on the consent screen.
- Add your redirect URIs: where Sevnly sends people back after they approve. They must be
https://, orhttp://localhost(also127.0.0.1and[::1]) while you build. Theredirect_uriyou send must match one of them exactly, and can’t have a#fragment. - Pick the permissions your app may ask for (below).
- Copy the client secret. It’s shown once; if you lose it, reset it from the app’s page.
New apps show as Unverified on the consent screen. Sevnly can mark an app as verified once we’ve checked who’s behind it.
Permissions
Ask only for what you need. People can untick any of them except openid, so check the scope you get back.
| Scope | What people see | What it allows |
|---|---|---|
openid |
Know who you are | An id_token and a sub that stays the same for your app |
profile |
See your name and picture | name, and picture when they’ve set a photo |
email |
See your email address | email and email_verified |
planners:read |
See your planners | Planners, tasks, lists and history |
notes:read |
Read your notes | Day notes, meeting notes and task notes |
tasks:write |
Add and change tasks | Add, edit, tick off, move and delete tasks and lists |
suggestions:write |
Suggest changes | Suggest changes and review suggestions |
comments:write |
Comment | Write and delete comments |
planners:manage |
Manage planners | Planner settings, members and webhooks |
Any planner scope comes with planners:read. People also choose which planners your app can reach: all of them, or only some. Everything an app changes is marked in the planner and can be undone.
The flow
Sevnly uses the authorization code flow with PKCE (S256). Everything is listed at https://api.sevnly.com/.well-known/openid-configuration.
1. Send people to the consent screen
https://sevnly.com/oauth/authorize
?response_type=code
&client_id=YOUR_CLIENT_ID
&redirect_uri=https://yourapp.com/callback
&scope=openid profile email planners:read
&state=RANDOM_STATE
&nonce=RANDOM_NONCE
&code_challenge=BASE64URL(SHA256(code_verifier))
&code_challenge_method=S256
If they say yes, they come back to redirect_uri?code=…&state=…. If they cancel, you get error=access_denied. Check that state matches the one you sent.
2. Swap the code for tokens
Send your client ID and secret with HTTP Basic auth (client_secret_basic; client_secret_post also works):
POST https://api.sevnly.com/oauth/token
Authorization: Basic base64(client_id:client_secret)
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&code=…&redirect_uri=…&code_verifier=…
You get back access_token (good for an hour), refresh_token (30 days), scope (what they actually allowed) and, with openid, an id_token. Codes work once and expire after 10 minutes.
3. Who signed in
The id_token is a JWT signed with ES256. Check it against the keys at https://api.sevnly.com/oauth/jwks, and check iss (https://api.sevnly.com), aud (your client ID) and nonce. Or call userinfo with the access token:
GET https://api.sevnly.com/oauth/userinfo
Authorization: Bearer ACCESS_TOKEN
4. Refresh
POST https://api.sevnly.com/oauth/token
Authorization: Basic base64(client_id:client_secret)
grant_type=refresh_token&refresh_token=…
Each refresh gives you a new refresh token; keep the newest one.
5. Sign out or disconnect
Revoke the access or refresh token when someone signs out of your app or disconnects it. This removes the connection (RFC 7009, always answers 200):
POST https://api.sevnly.com/oauth/revoke
Authorization: Basic base64(client_id:client_secret)
token=…
People can also disconnect your app any time in Settings → Integrations → Connected apps. After that, your tokens stop working.
The sub is only for your app
The sub you get is pairwise: it’s the same every time a person signs in to your app, but a different app sees a different sub for the same person. Use sub (not the email) as your user ID. Apps can’t match people up with each other.
Planner access
With a planner scope, the access token works on the MCP server at https://api.sevnly.com/mcp, with the same tools AI assistants use, limited to the scopes and planners the person allowed.
Example
A small Node server with fetch and no libraries:
import { createHash, randomBytes } from "node:crypto";
const CLIENT_ID = process.env.SEVNLY_CLIENT_ID;
const CLIENT_SECRET = process.env.SEVNLY_CLIENT_SECRET;
const REDIRECT = "https://yourapp.com/callback";
const b64url = (buf) => buf.toString("base64url");
// 1. Start: keep verifier, state and nonce in the user's session.
export function start(session) {
session.verifier = b64url(randomBytes(32));
session.state = b64url(randomBytes(16));
session.nonce = b64url(randomBytes(16));
const url = new URL("https://sevnly.com/oauth/authorize");
url.search = new URLSearchParams({
response_type: "code",
client_id: CLIENT_ID,
redirect_uri: REDIRECT,
scope: "openid profile email",
state: session.state,
nonce: session.nonce,
code_challenge: b64url(createHash("sha256").update(session.verifier).digest()),
code_challenge_method: "S256",
}).toString();
return url.href; // redirect the browser here
}
// 2. Callback: check state, swap the code, read who it is.
export async function callback(session, query) {
if (query.error || query.state !== session.state) throw new Error("Sign-in cancelled");
const res = await fetch("https://api.sevnly.com/oauth/token", {
method: "POST",
headers: {
authorization: `Basic ${Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString("base64")}`,
"content-type": "application/x-www-form-urlencoded",
},
body: new URLSearchParams({
grant_type: "authorization_code",
code: query.code,
redirect_uri: REDIRECT,
code_verifier: session.verifier,
}),
});
if (!res.ok) throw new Error("Couldn't sign in");
const tokens = await res.json();
// Verify tokens.id_token with a JWT library (jose) in production; userinfo is the simple way.
const me = await fetch("https://api.sevnly.com/oauth/userinfo", {
headers: { authorization: `Bearer ${tokens.access_token}` },
}).then((r) => r.json());
return { userId: me.sub, email: me.email, name: me.name, tokens };
}Was this helpful?