Loading TOC...

MarkLogic Server 11.0 Product Documentation
xdmp:jwt-decode

xdmp:jwt-decode(
   $JWT as xs:string
) as map:map

Summary

Extracts the contents of a JWT object.

Parameters
JWT JWT that is to be decoded.

Example

xquery version "1.0-ml";

xdmp:jwt-decode("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.NHVaYe26MbtOYhSKkoKYdFVomg4i8ZJd8_-RU8VNbftc4TSMb4bXP3l3YlNWACwyXPGffz5aXHc6lty1Y2t4SWRqGteragsVdZufDn5BlnJl9pdR_kdVFUsra2rWKEofkZeIC4yWytE58sMIihvo9H1ScmmVwBcQP6XETqYd0aSHp1gOa9RdUPDvoXQ5oqygTqVtxaDr6wUFKrKItgBMzWIdNZ6y7O9E0DhEPTbE9rfBo6KTFsHAZnMg4k68CDp2woYIaXbmYTWcvbzIuHO7_37GT79XdIwkm95QJ7hYC9RiwrV7mesbY4PAahERJawntho0my942XheVLmGwLMBkQ")

=> {
  "header": {
    "alg": "RS256", 
    "typ": "JWT"
  }, 
  "payload": {
    "admin": "true", 
    "iat": "1516239022", 
    "name": "John Doe", 
    "sub": "1234567890"
  }
}

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.