【问题标题】:Error during theme creation in fusionauth在fusionauth中创建主题时出错
【发布时间】:2019-12-13 14:12:49
【问题描述】:

我正在尝试使用 javascript FusionAuthClient 在 fusionauth 中创建一个主题。基本上这个想法是克隆默认主题并简单地覆盖一些模板。

this.fusionClient.retrieveThemes().then((response) => {
  return response.successResponse.themes[0].id;
}).then((defaultThemeId) => {
  // set this to instruct fusion to clone default theme
  request.sourceThemeId = defaultThemeId;
  request.theme.name = 'Some-Theme-Name';
  return this.fusionClient.createTheme('SomeCustomId', request);
}).then((response) => {
  this.context.themeId = response.successResponse.themes[0].id;
  // -> follows tenant creation etc.
});

请求正文 json 与此处https://fusionauth.io/docs/v1/tech/apis/themes 中的文档相同

当我执行这个时,fusionClient.createTheme('id', request) 之后我得到一个错误响应

Error provisioning the security
{"statusCode":400,"errorResponse":{"fieldErrors":{"themeId":[{"code":"[couldNotConvert]themeId"}]}},"successResponse":null,"exception":null}

我猜themeId 是传递给createTheme 方法的第一个参数,我不知道它有什么问题。根据文档,这个参数是可选的,我尝试了不同的值,但与 autcome 的错误相同。 我在 fusion 的日志中没有看到任何异常。

有什么想法会发生什么以及如何克服这个问题?

【问题讨论】:

    标签: javascript fusionauth


    【解决方案1】:

    显然在 FusionAuthClient 的文档中存在差异,它是 @param {?string} themeId (Optional) The Id for the theme. If not provided a secure random UUID will be generated.,并且字符串必须是 UUID 实际上并不明显,因为它在主题的 API 文档中给出,这里是 https://fusionauth.io/docs/v1/tech/apis/themesthemeId [UUID]。 所以在我提供了一个 uuid 之后,一切正常。如果提供了null,它也可以工作,但是id是自动生成的。

    【讨论】:

    • 你是对的,参数是带引号的字符串格式的 UUID。也许我们可以增强为客户端库生成的 JSdoc 以减少混乱。谢谢!
    • JSDoc中的类型是正确的,但是注释可以添加一些关于“字符串?”的细节。需要采用 UUID 格式。
    • JSDoc 已更新以增加对该参数类型的一些额外说明。谢谢@factor5!
    • 酷,谢谢。这可能看起来微不足道,但它会帮助其他人并消磨他们的时间。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-21
    • 2021-07-04
    • 2017-10-18
    • 1970-01-01
    • 2021-03-17
    • 1970-01-01
    相关资源
    最近更新 更多