Authentication
How the widget key, allowed domains, endpoint auth headers and signed visitor tokens fit together.
Four things called “authentication”
They solve different problems, so it helps to keep them apart:
- •Widget key: identifies your store to repliyo.
- •Allowed domains: optionally limits which sites can use that key.
- •Endpoint auth header: lets repliyo authenticate to your API.
- •Visitor identity: tells repliyo who the person chatting is, so order and booking data goes to the right person.
Widget key
Each store gets a key starting with pk_live_, shown on the API Key page. It goes in the script tag as data-keyand ties every conversation to your store's settings, endpoints and documents. Conversations are scoped to a single key, so one store's data is never visible to another.
To rotate it, use the rotate button on the API Key page. Rotating immediately invalidates the old key, so have the new snippet ready to deploy first — any page still using the old key stops working until it's updated.
Allowed domains
By default your key works from any site. On the API Key page you can instead list the domains that may use it: bare hostnames like shop.example.com (no scheme, path or port), or wildcards like *.example.com, up to 20 entries. An empty list means no restriction.
Endpoint auth header
When you connect an endpoint, you can set one header name and value — for example Authorization with Bearer …— that repliyo sends on every call to that endpoint. The value is write-only (it isn't displayed again after saving). Use HTTPS, and give the credential the least access it needs: read access to the data you want answered, not admin access.
Visitor identity
Order status, order list and booking questions involve personal data, so repliyo doesn't answer them for an unidentified visitor straight away.
Anonymous visitorsare asked for the email address associated with their account first, then repliyo continues to your endpoint. repliyo doesn't verify that email itself or look up your customers, so treat it as a speed bump, not proof of identity.
Identified visitors skip that step, and this is the option to use if you want real protection. If your customers log in to your store, give the widget a signed token saying who they are. repliyo then fills that ID into any endpoint URL that contains {user_id}, for example https://shop.example.com/api/customers/{user_id}/orders, so your API can return only that customer's records.
// On YOUR server (Node.js)
const jwt = require('jsonwebtoken');
const userToken = jwt.sign(
{ user_id: user.id },
process.env.REPLIYO_API_KEY, // your pk_live_... key
{ algorithm: 'HS256', expiresIn: '1h' }
);# On YOUR server (Python)
import jwt
user_token = jwt.encode(
{"user_id": str(user.id)},
REPLIYO_API_KEY, # your pk_live_... key
algorithm="HS256",
)<!-- Option 1: render the token into the page from your backend -->
<script src="..." data-key="pk_live_your_key" data-user-token="{{ user_token }}" async></script>
// Option 2: single-page apps — call after login
window.repliyo.identify(userToken);
// On logout: drop the identity and reconnect anonymously
window.repliyo.reset();- •The token is a standard JWT signed with HS256, using your widget key as the secret, with a user_id claim.
- •Sign it on your server, never in browser code, and give it a short expiry.
- •A missing, expired or invalid token never blocks the chat. The visitor is simply treated as anonymous.
- •The widget connects when the chat is first opened, so calling identify() before then is safe.
Next
See how this shapes order status and booking conversations, or read how repliyo handles data end to end on the Security page.
