Sign Users In from a Native App
Exchange your user’s JWT for a Komo session token, then open the hub in your app’s web view with that token. No Komo SDK needed. For other ways to embed Komo in an app, see Mobile App Integration.1. Set up the Workspace App
In the Komo Portal, go to Apps > Workspace Apps and open your app.- General: copy the App ID (for example
au1_<app-guid>orus1_<app-guid>). Leave Allowed origins empty. - Authentication: turn on JWT, choose RS256 (JWKS URL or public key) or HS256 (shared secret), and set Issuer and Audience if you use them.
- Claim Mapping: map your claims to contact fields, for example
emailto Email,first_nameto First name,last_nameto Last name. - Paste a sample token into JWT for testing to check it.
2. Exchange the JWT for a session token
Call the session API from your backend or app. Your JWT must have:algRS256 or HS256, matching the Workspace App.issandaudmatching the app’s Issuer and Audience (if set).exp. Keep it short-lived; the JWT is used once.- At least one claim you mapped on Claim Mapping (for example
email). kidonly if you use a JWKS URL.
au1_ or us1_). Call https://api.{region}.komo.site and send the App ID without the prefix as appId. Sending the full App ID returns HTTP 400. This applies only when you call the session API directly. Komo’s web and React Native SDKs take the full App ID.
Request:
success):
3. Open the hub
Open the hub home page or any page in your app’s web view, with a fresh session token:- The hub recognises the user as a known contact, so everything on it knows who they are: cards, their profile, loyalty and more. Forms can be prefilled or skipped using auto submit, and their profile is set up from your JWT claims.
- Komo removes
komo_sessionfrom the address bar and history. Other URL parameters, such asutm_source, are kept. - Opening the hub with a token for a different user switches it to that user.
- The hub keeps recognising the user after the token’s 60 minutes. The token is used once; later opens without a token are still recognised through the hub’s long-lived cookie, as long as the web view keeps its data.
4. Refresh the session token (optional)
Only needed if your app keeps a session token to reopen the hub later. If you exchange a fresh JWT right before each open, skip this step. Request:5. Sign out
When a user signs out of your app, clear the web view’s cookies and website data for the hub domain.Good to know
- The user changes in your app: exchange a token for the new user and open the hub with it.
- Invalid or expired session token: the hub loads with no error and keeps recognising whoever it already knew, which is why step 5 matters.
- User agent: keep the web view’s default user agent, or append to it rather than replacing it.
- Security: keep signing keys on your servers, and don’t log the session token or send it anywhere except the hub URL.
Need Help? Contact [email protected] for mobile integration assistance.
