<?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[Cloudron OIDC &#x2F;.well-known&#x2F;openid-configuration shows refresh_token in grant_types_supported but offline_access scope does not cause a refresh_token to be returned from the token endpoint]]></title><description><![CDATA[<p dir="auto">When looking at <code>https://&lt;CloudronDashboardHost&gt;/.well-known/openid-configuration</code> I see that it includes <code>refresh_token</code> in <code>grant_types_supported</code>.</p>
<p dir="auto">If I go through the authorization flow with the scope of <code>openid offline_access</code> the response from the token endpoint does not include a <code>refresh_token</code>.</p>
<p dir="auto">I did notice that in the documentation for oidc-provider it has an example of defining a <a href="https://github.com/panva/node-oidc-provider/blob/87cd3c5c335cb30074612b405bd581c6bc76a98d/docs/README.md#ttl:~:text=RefreshToken%3A%20function%20RefreshTokenTTL" target="_blank" rel="noopener noreferrer nofollow ugc">ttl for RefreshToken</a> but in the oidc.js code used in the box application <a href="https://git.cloudron.io/cloudron/box/-/blob/master/src/oidc.js#L792" target="_blank" rel="noopener noreferrer nofollow ugc">it specifies the other ttl values</a> but none for RefreshToken.</p>
<p dir="auto">Steps to reproduce via <a href="https://github.com/PowerShell/PowerShell" target="_blank" rel="noopener noreferrer nofollow ugc">PowerShell</a> (this is the simplest method I have found for testing OIDC stuff but I get the same results with code implemented in javascript using fetch running in a chrome extension service worker):</p>
<ul>
<li>Install the PSAuthClient module</li>
</ul>
<pre><code>Install-Module -Name PSAuthClient
</code></pre>
<ul>
<li>Run the following to get an a response from the authorization endpoint to start the process</li>
</ul>
<pre><code>$OidcMetaData = Get-OidcDiscoveryMetadata -uri https://&lt;CloudronDashboardHost&gt;/.well-known/openid-configuration
$ClientID = "&lt;ValueOfCLOUDRON_OIDC_CLIENT_IDGoesHere&gt;"
$ClientSecret = "&lt;ValueOfCLOUDRON_OIDC_CLIENT_SECRETGoesHere&gt;"
$Scope = "openid"
$Scope = "openid offline_access"

$AuthorizationEndpointResponse = Invoke-AuthorizationEndpoint -uri $OidcMetaData.authorization_endpoint -client_id $ClientID -redirect_uri "http://localhost" -response_type "code" -scope $Scope -Verbose
$AuthorizationEndpointResponse
</code></pre>
<p dir="auto">Example output:</p>
<pre><code>Name                           Value
----                           -----
code                           MwGkfTFphYMb7hp5t7_WCkgstwgWT1KZuLiOVSjBQIx
redirect_uri                   http://localhost
client_id                      &lt;Redacted&gt;
nonce                          W2lFWf-nEkeOZ5u6anNovQvde016-U0N
code_verifier                  tpZVJsWM_0SqdHnFfNl5vSGIf9B.gQhEBgQjBTrEGBt5kLaYhUDVv95ZOUvKDeb9O30eJ2L~liJMX3L3Gt70ackXLXceh03ht6r7T9T7p3DSv
</code></pre>
<ul>
<li>Now run the following to get an a response from the token endpoint that I believe should include a <code>refresh_token</code> but doesn't</li>
</ul>
<pre><code>$TokenEndpointResponse = Invoke-TokenEndpoint -uri $OidcMetaData.token_endpoint -client_id $ClientID -client_secret $ClientSecret -client_auth_method client_secret_post -Verbose -code $AuthorizationEndpointResponse.code -redirect_uri "http://localhost" -code_verifier $AuthorizationEndpointResponse.code_verifier
$TokenEndpointResponse
</code></pre>
<p dir="auto">Example:</p>
<pre><code>access_token    : &lt;Redacted&gt;
expires_in      : 3600
id_token        : &lt;Redacted&gt;
scope           : openid
token_type      : Bearer
expiry_datetime : 3/29/2024 1:12:54 PM
</code></pre>
<p dir="auto">We can see that <code>refresh_token</code> is not included and also see that the <code>scope</code> doesn't include <code>offline_access</code>.</p>
<p dir="auto">If I run this again with <code>$Scope = "openid offline_access profile"</code> the token endpoint response includes <code>scope           : openid profile</code> and the <code>id_token</code> jwt includes additional profile data so other scopes do seem to work but not <code>offline_access</code>.</p>
<p dir="auto">For this to work <code>http://localhost</code> needs to be in the cloudron manifest:</p>
<pre><code>{
  ...
  "addons": {
    ...
    "oidc": {
      "loginRedirectUri":"...,http://localhost"
    }
  },
  ...
}
</code></pre>
<p dir="auto">What is the right way to get a <code>refresh_token</code> via cloudron's oidc?</p>
]]></description><link>https://forum.cloudron.io/topic/11431/cloudron-oidc-well-known-openid-configuration-shows-refresh_token-in-grant_types_supported-but-offline_access-scope-does-not-cause-a-refresh_token-to-be-returned-from-the-token-endpoint</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Mar 2026 04:51:19 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/11431.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 29 Mar 2024 16:36:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Cloudron OIDC &#x2F;.well-known&#x2F;openid-configuration shows refresh_token in grant_types_supported but offline_access scope does not cause a refresh_token to be returned from the token endpoint on Mon, 01 Apr 2024 15:20:20 GMT]]></title><description><![CDATA[<p dir="auto">Currently our OpenID provider does not issue any <code>refresh_token</code>s yet. All clients created without the <code>refresh_token</code> grant type.</p>
<p dir="auto">For the moment it is only useful as an identity provider as such. But we will extend it further based on requirements. Will look into this for the coming releases.</p>
]]></description><link>https://forum.cloudron.io/post/86118</link><guid isPermaLink="true">https://forum.cloudron.io/post/86118</guid><dc:creator><![CDATA[nebulon]]></dc:creator><pubDate>Mon, 01 Apr 2024 15:20:20 GMT</pubDate></item></channel></rss>