Concepts

The signed-in user

Who is asking, how Rendel reaches your API as them, and what happens when they sign out or switch accounts.

Three different things identify something in Rendel, and only one of them is anybody's permission to do anything.

What it isWhat it proves
Publishable key (rd_pk_…)Ships in your app or page. Names your app and its environment (test or live).Nothing about the person. Anyone with your app has it.
identifyThe id of the person signed in to your app, from your own sign-in.Who the conversation belongs to: their history, their memory, the person a confirmation was shown to. With identity verification on, an HMAC from your backend proves it, and only then does their "What I remember for you" list show their own preferences.
User tokenThe signed-in person's own token for your API, from your auth library.Whatever your API decides it proves. Your API checks it, as it does for your own app.

Your agent wires all three with one prompt: see Sign-in and identity.

When the token reaches us, and when it does not

  • Actions registered in your app run in your app, with your app's own session. The token never needs to leave the phone or the page.
  • Actions connected in the console and set to the signed-in user's token are called by our server, with the token your app hands over on that question, as Authorization: Bearer. It is used for that call and dropped. It is never stored, logged, shown in the console, or put in front of the model.
  • Any other console action uses a key you stored, an account made for Rendel, or nothing. Those may only read.

When it is asked for

Before every question. Return the current token: if your auth library refreshed it in the meantime, the new one is used. Return null when nobody is signed in. A provider that throws costs that question the token, not the answer.

What changes something, and for whom

A console action that changes something (a POST, PUT, PATCH or DELETE you marked as such) needs all of this:

  1. It runs as the signed-in user. The database refuses any other kind of credential for it.
  2. The turn names the person with identify (proved by HMAC if you verify identities). With nobody named, it is not offered.
  3. The user confirms it on the card, and the server records that tap for the device that owns the conversation. A write that names another console action that undoes it skips the card instead: the server calls it at once, and the answer offers Undo.
  4. The request that continues after the tap names the same person. A token refreshed for them is fine. Somebody else signed in on the same phone is not: the change is not made, and Rendel asks again.

The server then calls your endpoint once, however often the continuation is retried. If the answer is lost on the way back, Rendel says it does not know whether the change happened instead of trying again. See Actions from the console.

Sign-out and switching accounts

reset() clears the conversation on the device, the person, and any card still on screen; the next question is anonymous until the next identify. It also closes the page of their conversation with your team (Support) and forgets the list of those conversations, so the next person on the same device sees none of them. Calling identify with a different id clears the conversation too, and so does the first identify after a conversation asked signed out, whose answers were for nobody in particular; a conversation with your team asked signed out stays, as its reply is on its way. If your app switches accounts without calling either, the server still will not spend one person's confirmation on the next person's token (rule 4 above), but the old answers stay on screen, so call reset() on sign-out.

401 and 403

  • 401 from your endpoint, for a console action called as the user: the person's session has most likely ended. Rendel says so, and the call is not repeated. Your app's next token, from your own refresh, is used on the next question.
  • 403: your API said this person may not do this. Rendel tells them it cannot be done here. Nothing retries it.

Testing with a real account

On the console's Test page, Talk as signs in to your API as a test user, or creates one through your app's own sign-up, and sends the token with each question the way your app would. See Test as a real user.

A name without a signature

Without userHmac, the id your app passes is something anyone holding your publishable key could send. So Rendel trusts it only on an install that has been that person before: the phone or browser where they first used Rendel as themselves. There the turn is theirs, with what Rendel remembers about them and the traits your app passed. On any other install it is that install's own anonymous visitor, and an unsigned identify there links nothing and changes no traits. Actions that call your API with the person's own token still run as them there, because your API checks the token. Choose the action that answers with their own record under Settings › Security › Who is signed in, and a person it proves is themselves on every device, with nothing signed on your server (see Sign-in and identity).

Who your team sees

With Support on, your team sees how far to trust who they are talking to, on every message. Verified means your server signed the user id with userHmac. Claimed means your app named someone without a signature, so your team should check before sharing account details. Anonymous means nobody is signed in. Only a verified person's conversation follows them to another device; the rest stay on the device that started them.

Who enforces permissions

Your API. Rendel can reach only the actions you connected, only as the person asking, and only after they confirm anything that changes something; what that person is allowed to change is your API's decision, exactly as it is for your own app.