JWT Enrichment
JWT enrichment allows end user API requests to be enhanced with metadata stored in Revenium's platform to enable customized API responses based upon the user making the API call.
JWT Enrichment is commonly used to support use cases for which a backend application needs information stored about the customer's subscription in Revenium to determine which information how to reply to a customer query. For example, you could use JWT enrichment to enhance a customer's API call with their company name or email address to allow a backend application to match the call to a user license and determine which fields to return in the API call (i.e. fields tied to a 'premium' subscription versus a 'standard' subscription'
By incorporating a custom JWT claim into metered API requests, Revenium propagates the following metadata to backend API implementations:
Field | Description |
---|---|
organization | The organization the invoked API / product belongs to. |
consumingOrganization | The organization of the API consumer |
consumer | The email address of the API consumer |
product | The name of the product the API belongs to |
productTags | The tags associated with the product |
productLicenseTags | The tags associated with the product license |
productVersion | The version of the product the API belongs to |
assets | The other assets associated with the product the API belongs to |
expiration | The expiration date of the product license associated with the API consumer |
totalQuota | The quota associated with the product being invoked |
consumedQuota | The amount of quota being consumed. |
subscriptionStart | The start of the subscription |
subscriptionPeriodStart | The start of the current subscription period |
subscriptionPeriodEnd | The end of the current subscription period |
The JWT claim is propagated in the "X-HYPERCURRENT-CLAIM" header which can be parsed by the backend API implementation using any standard JWT Library.
Here is an example of a decoded Revenium JWT claim:
Here is Revenium's public key for JWT decoding:
JWT Parsing Example (Java)
The following code snippet uses the Auth0 JWT library to decode and parse a JWT:
Last updated