onSessionExpired. When the token stops working, the assistant calls it, waits for a new token, and replays the question that was pending. The customer sees nothing.
Promise<string>: the new token. It calls the same server route that opened the first one. See Per-user door.
When it runs
The assistant asks for a new token when Concatflow refuses the current one:- when the iframe loads, on first use, if the page has been open longer than 15 minutes;
- when the customer asks a question after the token expired.
When renewal fails
If your function throws, rejects, or returns something that is not a non-empty string, the assistant ignores it and keeps the panel open. Make your route return401 when the customer is no longer logged in, and throw on it, as above.