Create signed JWT
Create a signed JWT
POST
/appid-{appId}/recipe/jwtAuthorization
api-keyAPI key · headerrequiredThe core service API token. If you are using a self-hosted core service and you have not generated a token, you can omit the header.
Header parameters
ridstringcdi-versionstringX.Y of the X.Y.Z CDI version.
Request body
application/jsonpayloadcreateJWTPayloadThe payload of the JWT, should be a JSON object.
algorithmcreateJWTAlgorithmThe algorithm to use when creating the JWT.
Allowed:
RS256jwksDomainjwksDomainThis is used as the value for the issuer claim in the JWT payload.
validityjwtValidityDuration in seconds, used to calculate JWT expiry
useStaticSigningKeybooleanDecides if the token should be signed with a dynamic or static key, defaults to true
Responses
200Create a signed JWT
One of:
object
statusstatusOKAllowed:
OKjwtstringobject
statusstringAllowed:
UNSUPPORTED_ALGORITHM_ERROR400error code 400
string404error code 404
string500error code 500
stringTry it
Server
Authorization
Parameters
Bodyapplication/json
Request
curl -X POST "/appid-{appId}/recipe/jwt" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"payload": {
"custom-claim": ""
},
"algorithm": "RS256",
"jwksDomain": "https://api.test.com/",
"validity": 86400,
"useStaticSigningKey": true
}'const response = await fetch("/appid-{appId}/recipe/jwt", {
method: "POST",
headers: {
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({
"payload": {
"custom-claim": ""
},
"algorithm": "RS256",
"jwksDomain": "https://api.test.com/",
"validity": 86400,
"useStaticSigningKey": true
})
});import requests
response = requests.post(
"/appid-{appId}/recipe/jwt",
headers={
"api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
json={
"payload": {
"custom-claim": ""
},
"algorithm": "RS256",
"jwksDomain": "https://api.test.com/",
"validity": 86400,
"useStaticSigningKey": True
},
)Response
{
"status": "OK",
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}"string""Not Found""Internal Error"