Skip to content

Web apps

A web app is a website or single-page app that people open from Protokol and sign in to with their Protokol account. You create it under Developer → Web apps, next to your other apps. This guide covers creating one, keeping it private or publishing it, the launch flow, how project admins install it, workspace access, and signing in.

Web apps are different from OAuth clients, which are credentials for integrations that call the Protokol API (scripts, CLIs, servers). If you are building an integration, read the OAuth page instead.


Create a web app

  1. Sign in to the Protokol dashboard as a project admin.
  2. Open Developer → Web apps and choose Create web app.
  3. Fill in the form:
Field Description
Name, description, logo, links Shown on the consent screen and, for public apps, in the marketplace
Launch URL Where Protokol sends people who open your app. See Registering a Launch URL
Redirect URIs Exact https:// callback URIs of your app
Sign in The profile and email details your app asks for, see Sign in with Protokol
API permissions Optional. Only needed if your app calls the Protokol API. Sign-in-only apps need none
Visibility Private or Public, see below
  1. Save. For a confidential app the client secret is shown once. Copy it into your secret store. You can rotate it later from the app's page.

A web app is confidential by default. A single-page app that cannot keep a secret can be created as a public client and uses PKCE.


Private or public

Private Public
Who can use it Members of your project Members of any project that installs it
Review None Protokol reviews it before it is listed
Marketplace Never listed Listed after approval
Home screen On the home screen of your project's members, once a Launch URL is set On the home screen of the members of every project that installed it
Changes Apply immediately New revisions are reviewed, see Publication and revisions

A private app needs no review and never appears in the marketplace. Setting a Launch URL puts it on the home screen of every member of your project. Members sign in to it with the same Sign in with Protokol flow and approve it once each.


Registering a Launch URL

Set a Launch URL on your web app. Protokol sends the user's browser there when they open your app from their home screen or the marketplace.

  • It must be https, with no fragment and no credentials in the URL.
  • Its host must share the registrable domain with one of your redirect URIs. For example https://app.example.com/start works with a redirect URI on https://app.example.com/callback or https://auth.example.com/callback.

What Protokol sends

Protokol redirects the browser with a GET request to your Launch URL:

GET https://app.example.com/start?iss=https://lemon.protokol.io&project_id=PROJECT_ID

iss is the issuer and project_id is the project the user is working in. These are the only parameters Protokol adds.

Your app then:

  1. Checks that iss equals the issuer from the discovery document. Reject the request otherwise.
  2. Starts its normal OpenID Connect authorize request, with a fresh state, nonce and PKCE challenge, and forwards project_id as the project_id parameter. The user is then not asked to choose a project again.

We recommend sending prompt=none first. If the user already approved your app, they get straight in without any screen. If the result is a login_required or consent_required error, send the user through again with a normal authorize request, without prompt=none. The first time a user opens your app they see the consent screen once.

The Launch URL is only a starting point. Apart from the project it carries no user information and no code, so always complete the full authorization code flow.


Installing the app in a project

A project admin installs your app from the Protokol marketplace before the project's members can sign in to it. Members who open the app from the marketplace card are told to ask a project admin to install it, and installed apps appear under Your apps on every member's home page.

When someone signs in from your own site to a project that does not have the app yet:

  • A project admin sees the consent screen with a notice that approving also installs the app in the project.
  • A member sees a message asking them to contact a project admin. They can only decline, which returns access_denied to your redirect_uri.
  • With prompt=none the authorize request returns the error interaction_required. Send the user through again without prompt=none.

If an admin uninstalls the app, the access of every member of that project is revoked: access tokens stop working and refresh tokens are rejected. Your own project does not need to install your app, so you can test without installing it.


Managing installed apps

Project admins manage the marketplace apps installed in their project under Developer → Web apps → Installed from the marketplace. Each installed app has a page with its workspace access, the permissions you can add for it, and Uninstall, in one place next to your own web apps.


Workspace access

Project admins choose which workspaces can use an app, when they install it and later. By default every workspace has access. A member whose role is not linked to any allowed workspace cannot sign in to the app in that project: the consent screen tells them to ask a project admin, prompt=none returns access_denied, and the app does not appear on their home page. Project admins always have access. Narrowing the workspaces revokes the access of members who no longer qualify, so their refresh tokens are rejected with invalid_grant. The same applies to private apps.


Permissions your app gets

The permissions in your app's access token come from three sources. Your app never asks for the second and third itself.

Source Who sets it Depends on the user's own rights?
What users approve at sign-in The user, on the consent screen Yes. A user can only approve what they hold
Entitlements You, the developer No. They are always granted
Grants from a project admin An admin of a project that installed your app, after installing Regular grants: yes, and the user must approve them. Forced grants: no

What users approve. Your app requests permissions in the scope of the authorize request, up to the API permissions you allowed on the app. The user approves them on the consent screen, and the token holds only what the user is allowed to do in that project.

Entitlements. List the permissions your app always needs on the app's page under Developer → Web apps. They are in every token whatever the member's role, and members are not asked to approve them. Entitlements are literal permission names: no patterns or wildcards. For a public app they are part of the listing, so a change goes through review like the other listing fields. Project admins see them, read-only, when they install the app, and in your own project they apply as soon as you save.

Grants from a project admin. Grants are only for apps installed from another project. In the project that owns the app there are no admin grants: set what the app gets with its API permissions and entitlements. After installing the app, a project admin can add any permission of the project from the app's Settings. A regular grant is an offer: it is shown to each member who holds that permission as "New from your project admin" the next time they sign in, and it reaches your app's token only after they approve it. A member who declines is not asked again. A forced grant is given to every member who can use the app, whatever their role, without asking, so admins should add one only when the app does the work on the project's behalf. Entitlements and forced grants are shown to users on the consent screen under "Also granted", but they do not have to approve them.

Entitlements and grants never apply to a member who cannot use the app, because the app is not installed or the member has no workspace access.

Silent sign-in and new offers

A user who has already approved your app normally signs in without seeing a screen. If a project admin adds a regular grant the user has not decided on yet, the next interactive sign-in shows the consent screen once so they can approve or decline it. A silent sign-in with prompt=none returns consent_required in that case, so send the user through again without prompt=none. Forced grants and entitlements never cause this. If an admin later removes a regular grant, it drops out of the token at the next refresh.

When changes apply

Changes to entitlements and admin grants reach your app at its next token refresh or code exchange. Access tokens that are already issued keep what they were issued with until they expire or are refreshed. Request offline_access if your app needs to pick up changes without sending the user through sign-in again.

Telling them apart

The token response scope and the introspection response list the permissions the token actually holds. Introspection also returns oauth_ungated, the subset that was granted regardless of the user's own rights (entitlements and forced grants):

{
  "active": true,
  "scope": "perm64:… perm64:…",
  "oauth_ungated": ["manage orders"]
}

If your app acts on a user's behalf, treat the permissions in oauth_ungated as things the app may do for anyone, and the others as things this particular user may do.


Where users find the app

Public web apps appear in the Web apps section of the Protokol marketplace. Installed apps and your project's private apps appear under Your apps on every member's home page.


Publication and revisions

  1. Set the app's visibility to Public and choose Request publication. Protokol reviews it before it is listed.
  2. After approval, the app is listed in the marketplace.
  3. Edits to these listing fields create a new revision: name, description, logo, homepage, terms of service, privacy policy, Launch URL and redirect URIs.
  4. The marketplace keeps showing the approved version until Protokol approves the new revision. An edit never removes your app from the marketplace.

Which version people see depends on who they are:

Who Sees
Users outside your project Only the approved version. New redirect URIs start working for them only after approval
Your own project Your changes immediately, so you can test them before review

Signing in

Your app signs users in with the standard authorization code flow with PKCE, using OpenID Connect: see Sign in with Protokol for the authorize request, the id_token and userinfo. project_id is optional on the authorize request, and the token response tells you which project the user chose.

Choosing the project

If you leave out project_id, users only see projects where your app is installed. If it is not installed in any of their projects, sign-in returns access_denied, so tell those users to install your app from the Protokol marketplace, or to ask a project admin to. See Choosing the project.

Sign-in-only apps

An app that only needs to know who the user is can be published without any API permissions: see Sign-in-only apps.


Signing users out when access ends

Your app keeps its own session for a signed-in user. When their access to your app ends in Protokol, that session does not end by itself, so your app has to find out and sign the user out.

Access ends when:

  • the user disconnects your app from their authorized apps;
  • a project admin revokes the app's access;
  • a project admin uninstalls the app from the project;
  • a project admin narrows the app's workspace access so the user no longer qualifies;
  • the app is suspended or deleted;
  • the user's refresh is rejected because they lost access.

Minimum: re-check with userinfo

At the very least, call the userinfo endpoint with the user's access token on each page load, or at a short interval. A 401 means the token has been revoked. End the user's session in your app and send them through sign-in again. Access tokens are short-lived, so a user whose access ended is also stopped when the token expires and cannot be refreshed.

Back-channel logout

For immediate sign-out, register a Sign-out notification URL on your web app (back-channel logout). Protokol sends a signed logout token to it as soon as a sign-in session ends, as described by OpenID Connect Back-Channel Logout 1.0. Discovery advertises it with backchannel_logout_supported.

The URL must be https, with no fragment and no credentials, and on the same registrable domain as one of your redirect URIs. For a public app it is part of the listing, so changing it goes through review like the other listing fields. Protokol only sends a logout when the user signed in with openid.

Protokol sends a POST with Content-Type: application/x-www-form-urlencoded and one field, logout_token:

POST /backchannel-logout HTTP/1.1
Host: app.example.com
Content-Type: application/x-www-form-urlencoded

logout_token=eyJ…

The logout token is a JWT signed with the same key as ID tokens (RS256, keys in the JWKS). Its header has typ: logout+jwt. Its claims are:

Claim Value
iss The issuer from the discovery document
aud Your client_id
iat, exp Issued at, and two minutes later
jti A unique id. Remember recent ones and reject repeats
sub The user's subject, the same value as in their ID token
events {"http://schemas.openid.net/event/backchannel-logout": {}}
project_id The project whose access ended. End only that project's sessions

There is no nonce and no sid. Validate the token before you act on it:

  1. Verify the signature with the JWKS and check that typ is logout+jwt.
  2. Check iss, that aud is your client_id, and that the token has not expired.
  3. Check that events contains the back-channel logout event and that there is no nonce.
  4. Check that jti has not been seen before.

Then end every session of your app for that sub and project_id, and reply with 200. Reply 4xx if the token is invalid. Protokol retries 5xx responses, 408, 429 and timeouts a few times with increasing delays, and does not follow redirects. Respond quickly: the request times out after five seconds. The URL must resolve to a public address.


Checklist

  • Use a https Launch URL on the same registrable domain as a redirect URI.
  • Check iss before you start the authorize request, then forward project_id to authorize.
  • Try prompt=none first and fall back to a normal authorize on login_required or consent_required.
  • Test revisions in your own project, then wait for approval before relying on them for other users.