0

I'm trying to create a theme in fusionauth using the javascript FusionAuthClient. Basically the idea is to clone the default theme and to simply override some of the templates.

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.
});

The request body json is same as in the documentation here https://fusionauth.io/docs/v1/tech/apis/themes

When I execute this, after the fusionClient.createTheme('id', request) I get an error response

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

Where the themeId is the first argument passed to createTheme method I guess, what is wrong with it I've no idea. According to documentation, this argument is optional and I tried differen t values for it but with the same error as autcome. I don't see any exceptions in fusion's log.

Any ideas what happens and how to overcome this?

factor5
  • 321
  • 2
  • 12

1 Answers1

1

Obviously there is a discrepancy in the documentation of the FusionAuthClient where it sais @param {?string} themeId (Optional) The Id for the theme. If not provided a secure random UUID will be generated. and it's not obvious that the string must be an UUID actually as it's given in the theme's API documentation here https://fusionauth.io/docs/v1/tech/apis/themes themeId [UUID]. So after I provided an uuid it went ok. It also works if null is provided but then the id is auto-generated.

factor5
  • 321
  • 2
  • 12
  • 1
    You are correct, the parameter is a UUID in a quoted string format. Perhaps we can enhance the JSdoc that is generated for the client library to reduce confusion. Thanks! – robotdan Dec 13 '19 at 17:49
  • 1
    The type in the JSDoc is correct, but the comment could add some details about the "string?" needing to be in the UUID format. – voidmain Dec 13 '19 at 18:00
  • JSDoc has been updated to add some additional clarity on this parameter type. Thanks @factor5! – robotdan Dec 17 '19 at 04:19
  • Cool, thanks. It might seem trivial, but it'll help other people and spend their time. – factor5 Dec 17 '19 at 07:54