SDK integration
This guide is for tenant engineers embedding Narrative SDK UI into an existing web application.Prerequisites
You need:- a Connected App provisioned in Narrative SDK
- a backend endpoint in your tenant app that mints Embed Tokens
Required values
| Value | Suggested env var | Where it lives | Notes |
|---|---|---|---|
| NSDK host base URL | NSDK_BASE_URL | Tenant frontend config | Example: https://sdk.narrativebanking.com |
| Connected App client id | NSDK_CONNECTED_APP_CLIENT_ID | Tenant backend config | Used as JWT iss |
| Connected App secret key | NSDK_CONNECTED_APP_SECRET_KEY | Tenant backend only | HS256 signing key, never expose to frontend |
Embed Token requirements
- Standard: RFC 7519
- Algorithm: HS256
- Audience:
nsdk-embed - Recommended expiry: 5-15 minutes
| Claim | Type | Requirement |
|---|---|---|
iss | string | Connected App client id |
sub | string | Tenant user identifier |
aud | string | Must be nsdk-embed |
iat | number | Unix timestamp (seconds) |
exp | number | Unix timestamp (seconds) |
jti | string | Unique token id |
nsdk fields:
nsdk.user.namensdk.user.email
Token minting endpoint example
Common errors and troubleshooting
CORS blocks token endpoint
CORS blocks token endpoint
Use same-origin route, proxy, or explicit CORS with credentials configuration.
Invalid signature
Invalid signature
Ensure token is signed with the Connected App secret matching
iss.Invalid audience
Invalid audience
Set
aud exactly to nsdk-embed.Clock skew or wrong time unit
Clock skew or wrong time unit
Use Unix seconds (not milliseconds) and keep server time synchronized.