英文:
JSON response format when modifying user during beforeCreate blocking function (Google Identity Platform)
问题
我正在尝试在Google Identity Platform中使用Go运行时的beforeCreate阻塞函数来修改新创建的用户。到目前为止,我已经解析和验证了JWT,并且能够阻止或允许用户注册,但我不知道在修改正在处理的用户时,Google期望的JSON响应是什么。
文档专门针对使用Node.js SDK的开发人员编写,并没有提到在使用Go运行时实现相同功能时期望的JSON响应。我尝试在我的JSON响应中使用{"disabled":"true"}
,但在Node.js SDK之外,这并不起作用。有什么想法吗?
英文:
I'm trying to use the Go runtime in a beforeCreate blocking function to modify newly created users in Google Identity Platform. So far I've parsed and validated the JWT and I'm able to block or allow the user signup, but I don't know what JSON response Google expects when modifying the user being processed.
The docs are written exclusively for developers using the Node.js SDK, and don't mention the expected JSON response when implementing the same using the Go runtime. I tried using {"disabled":"true"}
in my JSON response, but that doesn't work outside the NodeJS SDK. Any thoughts?
答案1
得分: 0
在Go中编写的beforeCreate阻塞函数已经可以运行了!我不得不设置一个本地的Node.js环境来捕获Node.js SDK生成的beforeCreate阻塞函数的响应。
修改用户在创建之前的完整JSON响应模式如下:
{
"userRecord": {
"updateMask": "customClaims,disabled,displayName,emailVerified,photoUrl",
"customClaims": {
"exampleRole": "ExampleUserRole",
"otherExampleClaim": "ExampleUserClaim2",
"otherExampleUserProperty": "ExampleUserClaim3"
},
"disabled": true,
"displayName": "Example Name",
"emailVerified": false,
"photoUrl": "https://localhost/image.jpg"
}
}
例如,要禁用一个新用户:
{
"userRecord": {
"updateMask": "disabled",
"disabled": true
}
}
英文:
The blocking beforeCreate function written in Go is up and running now! I had to set up a local Node.js environment to capture the responses generated by the Node.js SDK to the beforeCreate blocking function.
The full JSON response schema to modify a user before creation is as follows:
{
"userRecord": {
"updateMask": "customClaims,disabled,displayName,emailVerified,photoUrl",
"customClaims": {
"exampleRole": "ExampleUserRole",
"otherExampleClaim": "ExampleUserClaim2",
"otherExampleUserProperty": "ExampleUserClaim3"
},
"disabled": true,
"displayName": "Example Name",
"emailVerified": false,
"photoUrl": "https://localhost/image.jpg"
}
}
To disable a new user for example:
{
"userRecord": {
"updateMask": "disabled",
"disabled": true
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论