XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    XCP-NG API token

    Scheduled Pinned Locked Moved REST API
    5 Posts 3 Posters 752 Views 3 Watching
    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.
    • Y Offline
      yeopil21
      last edited by

      Is there a way to make the expiration date of the API token provided by XCP-NG infinite?

      florentF 1 Reply Last reply Reply Quote 0
      • florentF Offline
        florent Vates 🪐 XO Team @yeopil21
        last edited by

        @yeopil21 you're probably thinking of the xen orchestra token
        it can be inifinite but you can customize the duration : authentication.maxTokenValidity in your config file

        Y 1 Reply Last reply Reply Quote 0
        • Y Offline
          yeopil21 @florent
          last edited by

          @florent

          /etc/xo-server/config.toml
          /opt/xen-orchestra/packages/xo-server/.xo-server.toml

          What items should I look at in the config settings file?

          florentF 1 Reply Last reply Reply Quote 0
          • florentF Offline
            florent Vates 🪐 XO Team @yeopil21
            last edited by

            @yeopil21
            I would add a file config.tokenValidity.toml in /etc/xo-server with this content

            [authentication]
            defaultTokenValidity = '1 year'
            maxTokenValidity = '1 year'
            
            
            L 1 Reply Last reply Reply Quote 1
            • L Offline
              LennertvdBerg @florent
              last edited by

              @florent, I had to do the same for Xen Orchestra Community Edition. In my case, config.toml already contained the [authentication] section, so adding a separate config.tokenValidity.toml file did not work.

              Instead, I had to modify the existing config.toml located at /opt/xo/xo-server.

              In my opinion, it is best to keep defaultTokenValidity set to 30 days as a fallback in case no value is specified. You can then simply increase maxTokenValidity to the duration you prefer.

              [authentication]
              defaultTokenValidity = '30 days'
              # default value of 0.5 years
              # comment out and increase to 5 years
              #maxTokenValidity = ' 0.5 year'
              maxTokenValidity = '5 year'
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post