JSON response format when modifying user during beforeCreate blocking function (Google Identity Platform)

huangapple go评论88阅读模式
英文:

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
  }
}

huangapple
  • 本文由 发表于 2022年8月30日 00:22:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/73531770.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定