0

我正在尝试使用 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 的日志中没有看到任何异常。

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

4

1 回答 1

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 /主题 themeId [UUID]。所以在我提供了一个 uuid 之后,一切正常。如果null提供了它也可以工作,但是 id 是自动生成的。

于 2019-12-13T14:35:29.660 回答