<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[REST API token generation via curl]]></title><description><![CDATA[<p dir="auto">Is there a method available, or planned, to generate a REST API token via curl?  My environment currently has tokens set to expire after 72 hours and regenerating it via xo-cli or pulling it through the web UI is an extra manual step.</p>
<p dir="auto">Being able to run something similar to the below to generate and store a token would help with automating some tasks I am looking to do on a scheduled basis</p>
<pre><code> curl --location 'https://XOA.company.lan/rest/v0/authorization/token' --data-urlencode 'grant_type=password' --data-urlencode 'username=admin' --data-urlencode 'password=P@$$w0rd'
</code></pre>
]]></description><link>https://xcp-ng.org/forum/topic/8051/rest-api-token-generation-via-curl</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 23:19:43 GMT</lastBuildDate><atom:link href="https://xcp-ng.org/forum/topic/8051.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Dec 2023 14:24:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 17:24:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dan89" aria-label="Profile: dan89">@<bdi>dan89</bdi></a> Yes, you can pass the <code>--expires</code> flag to change the validity of a token. But you cannot go above <a href="https://github.com/vatesfr/xen-orchestra/blob/f0da94081b7d0993acd1c617635de92771930d8d/packages/xo-server/config.toml#L46" target="_blank" rel="noopener noreferrer nofollow ugc"><code>maxTokenValidity</code></a> though you can increase it in your xo-server's config.</p>
<p dir="auto">Example:</p>
<pre><code class="language-sh">xo-cli --createToken --expiresIn 90d https://XOA.company.lan admin password
</code></pre>
]]></description><link>https://xcp-ng.org/forum/post/68226</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68226</guid><dc:creator><![CDATA[julien-f]]></dc:creator><pubDate>Thu, 07 Dec 2023 17:24:29 GMT</pubDate></item><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 16:52:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/julien-f" aria-label="Profile: julien-f">@<bdi>julien-f</bdi></a>  slightly off topic then, but is there a way to extend token expiration for a single user and not globally? Or to have a single user excluded from the global default?</p>
]]></description><link>https://xcp-ng.org/forum/post/68222</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68222</guid><dc:creator><![CDATA[dan89]]></dc:creator><pubDate>Thu, 07 Dec 2023 16:52:40 GMT</pubDate></item><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 16:40:30 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dan89" aria-label="Profile: dan89">@<bdi>dan89</bdi></a> I understand <img src="https://xcp-ng.org/forum/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=a78c449d9ac" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">But FYI, <a href="https://www.npmjs.com/package/xo-cli" target="_blank" rel="noopener noreferrer nofollow ugc"><code>xo-cli</code></a> can be installed on other machines than the XOA.</p>
<p dir="auto">Also, IMHO, it's better to use longer tokens instead of exposing credentials on your machines.</p>
]]></description><link>https://xcp-ng.org/forum/post/68221</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68221</guid><dc:creator><![CDATA[julien-f]]></dc:creator><pubDate>Thu, 07 Dec 2023 16:40:30 GMT</pubDate></item><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 16:35:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/julien-f" aria-label="Profile: julien-f">@<bdi>julien-f</bdi></a>  some of the scripts I need to be run can't always run on the XOA appliance and need to be run on other Linux/Windows hosts so the output can be manipulated for use via other programs/methods.</p>
<p dir="auto">Having a way to pass authentication through curl would give the ability to generate a token when not running scripts on the main XOA appliance.</p>
]]></description><link>https://xcp-ng.org/forum/post/68220</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68220</guid><dc:creator><![CDATA[dan89]]></dc:creator><pubDate>Thu, 07 Dec 2023 16:35:37 GMT</pubDate></item><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 16:03:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/dan89" aria-label="Profile: dan89">@<bdi>dan89</bdi></a> Nope, there is no way to achieve that this time.</p>
<p dir="auto">Why is it easier than <code>xo-cli --createToken https://XOA.company.lan admin password</code>?</p>
]]></description><link>https://xcp-ng.org/forum/post/68218</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68218</guid><dc:creator><![CDATA[julien-f]]></dc:creator><pubDate>Thu, 07 Dec 2023 16:03:31 GMT</pubDate></item><item><title><![CDATA[Reply to REST API token generation via curl on Thu, 07 Dec 2023 15:57:05 GMT]]></title><description><![CDATA[<p dir="auto">Ping <a class="plugin-mentions-user plugin-mentions-a" href="/forum/user/julien-f" aria-label="Profile: julien-f">@<bdi>julien-f</bdi></a></p>
]]></description><link>https://xcp-ng.org/forum/post/68217</link><guid isPermaLink="true">https://xcp-ng.org/forum/post/68217</guid><dc:creator><![CDATA[olivierlambert]]></dc:creator><pubDate>Thu, 07 Dec 2023 15:57:05 GMT</pubDate></item></channel></rss>