Register your app
Register the app
On the console, with no code.
- Open Connect an app in the console, under Apps, and go through its steps. The last step shows the values your app and backend need, and the API key and secrets only once.
-
Name your app also asks Does your app have an API that Otoko Identity calls?, Yes or No, with Yes to start with. That's your backend, which Otoko Identity asks on every sign-in and tells when sessions end, not the server that shows your pages. With none, Otoko Identity calls nothing, the app's roles are managed in the console, and the mobile kind isn't offered.
-
How people sign in picks the kind of app, Web app or Mobile app. A web app answers one more question: Does your app run server code when someone signs in? See Which kind of app?
-
The client ID it suggests is the app ID plus the kind:
<app id>-serverfor a web app answered Yes, the default,<app id>-webfor No, and<app id>-mobilefor a mobile app. -
Email, or Backend and email with a backend, asks who sends the app's emails, and the backend's address when there is one. See Emails.
-
Unticking Send this app's emails through Otoko Identity's mail server shows a Mail server section with every setting for the app's own mail, as on its Email tab: who the emails are from (From address and From display name), where answers go (Reply-to address and Reply-to display name, both optional), then Host, Port, Encryption, Username and Password, and the connection and read timeouts under Timeouts. A username and a password go together. The server is saved once the app is created, and can be changed later on the Email tab.
-
The last step, Connect your app, splits the values by where they're pasted. Each section has its own Copy all, which copies only its
NAME=valuelines:- Frontend, for a web app, into your web app's env file, or its server's for Yes:
IDENTITY_DISCOVERY_URL,IDENTITY_ISSUER,IDENTITY_CLIENT_ID,IDENTITY_REDIRECT_URIandIDENTITY_SCOPES. For Yes it also hasIDENTITY_CLIENT_SECRET, the Client secret, which stays on your server: send it with HTTP Basic authentication at the token endpoint. - Backend, with an API that Otoko Identity calls, into your backend's env file:
IDENTITY_URL,IDENTITY_APP_ID,IDENTITY_API_KEY,IDENTITY_CALLBACK_TOKEN(the webhook secret) andIDENTITY_ALLOWED_CLIENT_IDS. - Server, in its place with no such API:
IDENTITY_URL,IDENTITY_APP_IDandIDENTITY_API_KEY, only for a server of yours that calls Otoko Identity, such as to invite people. - Mobile app, for a mobile app:
IDENTITY_CLIENT_ID, which its tokens name.
A warning names every secret shown only now, such as The client secret, API key and webhook secret are shown only now.
With the app's own mail server saved, the kit offers Send test email. If it couldn't be saved, the kit says The mail server wasn't saved, so this app sends no email yet., with the reason: set it on the app's Email tab. The app and its secrets are kept either way.
- Frontend, for a web app, into your web app's env file, or its server's for Yes:
-
- The app id is a slug of lowercase letters, digits and hyphens. It names cookies, and never changes.
- Each client is one way of signing in, and the wizard makes the app's first one. A public client signs in through the browser. A confidential client is a server-side app: it signs in through the browser too, and proves itself at the token endpoint with a secret. A mobile client signs in through the app's backend, so it has no redirect addresses, and needs an app with a backend. Client IDs are unique across all apps.
- With a backend, the wizard makes the webhook secret and sets it on the app, then shows it once with the API key: give your backend both. The webhook secret is what Otoko Identity sends when it calls your backend, and until the app has one, sign-ins fail closed. Only a hash of the API key is kept, so it can't be shown again.
- Where signing out may go back to is its own list of post-logout redirect addresses: a sign-in redirect isn't one unless it is on that list too.
Note
Everything about the app stays on its page under Apps.
Which kind of app?
The kind is the first client's. Add other kinds later as clients of the same app, under Clients, as one product with a website and a phone app does.
Choose Web app or Mobile app. A web app then answers Does your app run server code when someone signs in?, which says where the sign-in code is swapped for tokens. It isn't the question in step 1: an app can have an API that Otoko Identity calls and still sign in from static pages, or run server code with no such API.
| Web app, Yes | Web app, No | Mobile app | |
|---|---|---|---|
| Client type | confidential | public | mobile |
| What it is | A website whose server runs code when someone signs in, such as Next.js on Vercel, Django, Rails or Express | Static files only, such as a static export, plain JavaScript or a docs site | A native iOS or Android app |
| Who shows the sign-in screen | Otoko Identity's pages | Otoko Identity's pages | The app's own screens |
| Who swaps the code for tokens | The app's server | The page, in the browser | The app's backend, never the phone |
| What proves it is this app | PKCE and the client secret, kept on the server | PKCE only | The app's API key, held by its backend |
| Needs an API that Otoko Identity calls | No | No | Yes |
- A phone app that signs in through your backend: pick Mobile app. The app must have an API that Otoko Identity calls. See Mobile apps.
- Anything people use in a web browser is a Web app. If its server runs code at sign-in, answer Yes, the default, such as Next.js on Vercel, Django, Rails or Express. Your server keeps the client secret, which never reaches the browser.
- If it's static files only, such as a static export, plain JavaScript or a docs site, pick Web app and answer No. The browser signs in with PKCE alone, as nothing in a page can keep a secret.
Recommended for new apps
Answer Yes, and sign in from your server, as a backend-for-frontend: the server swaps the code, keeps the tokens, and gives the browser only an httpOnly session cookie, so no token is ever in the page. Choose No only when the app truly has no server code, such as a static site. Don't guess from the framework: Next.js can be a static export, as these docs are.
A web app's answer can be changed later, on the client's page: turning Client authentication on or off switches it between confidential and public.
Your client ID
Each client has its own client ID, and client IDs are unique across all apps. The examples in these docs write it as your-client-id. Put your own in its place.