Obtain JSON Web Tokens in Liberty
We can obtain JSON Web Token (JWT) tokens from the JWT token generation endpoint in the jwt-1.0 feature.
For information about JWT APIs, see the Json Web Token or the API documentation included in the product in the ${wlp.install.dir}/dev directory.
- If we did not include credentials in the request, authenticate with your credentials to access
the JWT token generation endpoint at the following URL:
https://<host>:<port>/jwt/ibm/api/<configId>/token
After authentication succeeds, the MP-JWT format token is returned in JSON form. The token contains the user and groups for the user as recorded in the user registry of the server.
- Use the <configId> ID to refer to a corresponding JWTBuilder entry in the server.xml file. Specify token attributes, such as issuer and expiration time, in the JWTBuilder entry.
- If we do not define JWTBuilder elements in the server.xml file, use the defaultJWT element as the <configId> ID.
- Find the available JWT builder configuration attributes at jwtBuilder - JWT Builder (jwtBuilder).