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.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
Pass the compact JWE in thex-auth-token header when you create a session:
Replace
<session-endpoint> with the session-creation endpoint for your agent.How EkaCare Verifies
When a request arrives with anx-auth-token, EkaCare:
- 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).

