Skip to main content

Preface

This article explains how to add arbitrary claims to an ID token.

How to add claims to an ID token

Authlete’s /auth/authorization/issue API is the method for adding claims. In this article, the following claims are to be added. claims is the paramater to add claims. The request will be constructed as follows. (folded for readability)
Authlete will issue an ID token including the claims in accordance with the request above. The payload part of the ID token is as follows:

How to specify a custom value to “sub” claim

By default, Authlete uses the value of the “subject” parameter for “sub” claim in an ID token. If you want to specify your own value for this claim, use the special “sub” parameter instead of the “claims” parameter when making an API request. An example is shown below:
The resulted ID token would include the custom “sub” value as follows: