英文:
Keycloak Creating permission ticket keep facing (token `JsonToken.START_ARRAY`)
问题
我想按照这里的说明创建权限票据,但在正确的请求体的情况下一直遇到以下错误:
> 未捕获的服务器错误:
> com.fasterxml.jackson.databind.exc.MismatchedInputException: 无法从数组值(令牌JsonToken.START_ARRAY
)反序列化类型org.keycloak.representations.idm.authorization.PermissionTicketRepresentation
有什么建议吗?
英文:
I want to create permission ticket following the instructions here but keep facing the below error while the body is correct:
> Uncaught server error:
> com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot
> deserialize value of type
> org.keycloak.representations.idm.authorization.PermissionTicketRepresentation
> from Array value (token JsonToken.START_ARRAY
)
Any suggestions?
答案1
得分: 0
从文档中,权限票据接受一个简单的 JSON 对象:
{
"resource": "{resource_id}",
"requester": "{user_id}",
"granted": true,
"scopeName": "view"
}
但是在你的 Postman 请求中,你传递了一个 JSON 对象数组:
[{
"resource": "{resource_id}",
"requester": "{user_id}",
"granted": true,
"scopeName": "view"
}]
只需移除 '[' 和 ']' 并发送请求。
英文:
From the docs, Permission ticket accepts a simple json object
{
"resource": "{resource_id}",
"requester": "{user_id}",
"granted": true,
"scopeName": "view"
}
But In your postman request, you are passing an Array Of JSON object
[{
"resource": "{resource_id}",
"requester": "{user_id}",
"granted": true,
"scopeName": "view"
}]
Just remove the '[' and ']' and send the request.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论