Overview
Bring Your Own Auth (BYOA) lets you authenticate your own users to EkaCare agents without an OIDC flow. Your backend builds a short-lived encrypted token (JWE) containing the user’s identity, encrypts it with your shared secret, and sends it to EkaCare — which looks up your secret by its Key ID, decrypts the token, verifies it, and trusts the claims inside.The token is a JWE (encrypted), not a signed JWT (JWS). Your shared secret both identifies you
(via its Key ID) and decrypts the payload.
How It Works
Create a credential
In the Eka Developer Console (BYOA → Create) you get a Key ID and a
shared secret. The secret is shown only once — copy it immediately.
Build the claims
On your backend, assemble the user’s identity claims (see Token Structure).
Encrypt as a JWE
Encrypt the claims using your shared secret:
alg: dir, enc: A256GCM, with the protected header
kid set to your Key ID.Send it
Hand the token to your embedded MedAssist widget — via the
auth-token attribute or
EkaMedAssist.init({ authToken }). See Send the Token.Before You Begin
Create a BYOA credential in the Eka Developer Console. You will need:- Key ID — the public identifier for your credential (e.g.
byoa_xxxxxxxxxxxxxxxx); goes in the token’skidheader. - Shared secret — used to encrypt the token. Shown only once at creation.
- Issuer — the issuer URL you registered on the credential; the token’s
issclaim must match it exactly.
Token Structure
Thex-auth-token is a compact JWE with a protected header and an encrypted payload of claims.
Header
kid— your credential’s Key ID.alg—dir(the shared secret is used directly as the encryption key).enc—A256GCM(content encryption).
Payload claims
Your issuer — must exactly match the issuer registered on your credential.
Intended audience. Always
https://eka.care.Subject — the user identifier (for example, the mobile number with country code).
The user’s mobile number, with country code.
Issued-at time, in epoch seconds (UTC).
Expiry time, in epoch seconds. Keep it short —
iat + 300 (about 5 minutes).Recommended. A unique ID per request so EkaCare can reject replays of the same token.
The shared secret is a base64url-encoded 32-byte key. Decode it to 32 raw bytes before using it as the
A256GCM content-encryption key.Generate the Token
Build the claims, encrypt them as a JWE with your shared secret (alg: dir, enc: A256GCM, header
kid), and serialize to compact form. The shared secret is base64url-decoded to a 32-byte key.
Send the Token
The MedAssist widget is EkaCare’s embeddable chat widget. Copy its embed snippet from your agent’s Widget tab in the Developer Console (or see the widget quickstart), then add the token to it.
- Custom element — set the
auth-tokenattribute on the<eka-medassist-widget>element. Best when you can render the token into the page server-side. See the widget quickstart. - JavaScript — pass
authTokentoEkaMedAssist.init(). Best when the token is dynamic (e.g. minted per logged-in user at runtime). See the JavaScript API.
How EkaCare Verifies
When EkaCare receives the token, it:- Reads the
kidfrom the token header and looks up the matching shared secret and registered issuer. - Decrypts the JWE with your secret.
- Verifies the claims —
issmatches the registered issuer,audishttps://eka.care, andiatandexpare within the allowed window. If you include ajti, it must not have been seen before (replay protection).

