how to kickstart an application with specified uuid?
-
Hi,
In my kickstart.json, I have the following section:
{ "body": { "application": { "jwtConfiguration": { "accessTokenKeyId": "#{accessTokenSigningKeyId}", "enabled": true, "refreshTokenTimeToLiveInMinutes": 1440, "timeToLiveInSeconds": 3600 }, "lambdaConfiguration": { "accessTokenPopulateId": "#{hasuraLambdaId}" }, "loginConfiguration": { "allowTokenRefresh": true, "generateRefreshTokens": true, "requireAuthentication": true }, "name": "test-application", "roles": [ { "isDefault": true, "isSuperRole": false, "name": "user" }, { "isDefault": false, "isSuperRole": false, "name": "manager" } ] } }, "method": "POST", "url": "/api/application" }
In that kickstart, I would like to directly register a user in that application
test-application
. I figured I could set myself the application's id (with e.g.#{UUID()}
) and use that id in the user registration:{ "body": { "registration": { "applicationId": "#{THE_TEST_APPLICATION_ID}", "roles": [ "manager" ] }, "user": { "email": "#{managerEmail}", "password": "#{managerPassword}" } }, "method": "POST", "url": "/api/user/registration" },
However, I was not able to gather from the documentation how to achieve that. The applicationId is a request parameter and there seems to be no way to set it through a parameter in the
/api/application
body.Is there a to do what I want or do I have to register the user after fusionauth kickstart?
Thanks in advance for your advice!
-
Hiya.
You want to set a variable for the
applicationId
in thevariables
section.. Then you can reference it in both the application creation call and the registration call.https://github.com/FusionAuth/fusionauth-example-kickstart/blob/master/example-apps/joomla-sso.json has an example:
"variables": { "joomlaAppId": "#{UUID()}", },
You could also hardcode the same UUID instead of using
UUID()
.Does that help?
-
Hey Dan,
Thanks for your very useful advice. This line is critical in the configuration you mention:
"url": "/api/application/#{joomlaAppId}",
I didn't know I could put the request parameter right there. My problem is then solved.
-
No worries @laurent-michel !
FYI, this isn't just for applications.
For every resource in FusionAuth during creation you can either provide a valid UUID to control the value, or leave the UUID off and let FusionAuth create one for you.