Moffen
Moffen

Reputation: 2003

Can you set an Application's Client Secret using a kickstart file? FusionAuth

I am using a kickstart.json file to setup FusionAuth in developer environments. Everything is automated except I still need to manually go and get the client secret from the fusion auth instance. Is there anyway I can predefine the client secret in the kickstart file so I can pre-configure it in my app?

Upvotes: 1

Views: 153

Answers (1)

mooreds
mooreds

Reputation: 4978

you should absolutely be able to set the client secret from kickstart.json. Any API call should work from within Kickstart.

https://fusionauth.io/docs/v1/tech/apis/applications#create-an-application indicates you can POST an application including the client secret.

So a kickstart file like this should work:

{
  "variables": {
    "defaultTenantId": "30663132-6464-6665-3032-326466613934"
  },
  "apiKeys": [
    {
      "key": "mykey",
      "description": "API key"
    }
  ],
  "requests": [
    {
      "method": "POST",
      "url": "/api/application/85a03867-dccf-4882-adde-1a79aeec50df",
      "body": {
        "application": {
          "name": "Pied Piper",
          "roles": [
            {
              "name": "dev"
            },
            {
              "name": "ceo"
            },
            {
              "name": "intern"
            }
          ],
          "oauthConfiguration" : {
             "clientSecret": "shhh-your-desired-secret"
          }
        }
      }
    }
  ]
}

I haven't tested that, but don't see any reason why it would not work. (Note that 1.37, the most recent version, has an issue with kickstart as documented here: https://github.com/FusionAuth/fusionauth-issues/issues/1816 but that should be fixed soon.)

If this doesn't work for you, please share the error message and a scrubbed kickstart file.

Upvotes: 1

Related Questions