• Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login
FusionAuth
  • Home
  • Categories
  • Recent
  • Popular
  • Pricing
  • Contact us
  • Docs
  • Login

how to kickstart an application with specified uuid?

Scheduled Pinned Locked Moved
Q&A
0
4
536
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L
    laurent.michel
    last edited by 27 Sept 2021, 15:12

    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!

    1 Reply Last reply Reply Quote 0
    • D
      dan
      last edited by 29 Sept 2021, 01:48

      Hiya.

      You want to set a variable for the applicationId in the variables 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?

      --
      FusionAuth - Auth for devs, built by devs.
      https://fusionauth.io

      1 Reply Last reply Reply Quote 0
      • L
        laurent.michel
        last edited by 29 Sept 2021, 04:43

        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.

        1 Reply Last reply Reply Quote 0
        • D
          dan
          last edited by 29 Sept 2021, 15:05

          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.

          --
          FusionAuth - Auth for devs, built by devs.
          https://fusionauth.io

          1 Reply Last reply Reply Quote 0
          4 out of 4
          • First post
            4/4
            Last post