JWT Enrichment
JWT enrichment allows end subscribers 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 Subscriber's subscription in Revenium to determine which information how to reply to a subscriber query. For example, you could use JWT enrichment to enhance a Subscriber's API call with their company name or email address to allow a backend application to match the call to a subscriber 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 subscriber |
subscriber | The email address of the API subscriber |
product | The name of the product the API belongs to |
productTags | The tags associated with the product |
subscriptionTags | The tags associated with the subscription |
productVersion | The version of the product the API belongs to |
sources | The other sources associated with the product the API belongs to |
expiration | The expiration date of the subscription associated with the API subscriber |
totalQuota | The quota associated with the product being invoked |
consumedQuota | The amount of quota being subscribed. |
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