TGIMBA .NET Core – Pre-API work – JWT Embedded Object

To continue my previous post, I was able to place a custom data point inside a claim and retrieve it in the controller.  This is good enough, but it bugged me that I didn’t know how to place a data point in the JSON (JavaScript Object Notation) Web Token (JWT) itself.

At a previous job, this is what we had done.  We placed a customer id inside the token and retrieved it when it was decrypted during authentication (difference was this was a Node JS Type Script API).  But, after poking around a little more, I found my answer in a payload option (reference #4).  More specifically, you can place an object in the payload of the JWT token at creation and retrieve it in the controller.

The steps are:

  • Call the authentication code that generates the JWT token.


  • On your authentication code (TokenController.cs here), add an object to the payload.


  • Inside your controller (ValuesController.cs here), consume the object


I believe I have found the solution I will be using for the TGIMBA API 🙂

Stay tuned!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s