<?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[No Refresh Tokens from grant_type = authorizazion_code; python]]></title><description><![CDATA[<p dir="auto">Currently we are testing FusionAuth with the python package:</p>
<p dir="auto">When we use:<br />
exchange_o_auth_code_for_access_token()<br />
we get an access_token but no refresh token.</p>
<p dir="auto">We modified the the function inside the package:<br />
body = {<br />
"code": code,<br />
"client_id": client_id,<br />
"client_secret": client_secret,<br />
"grant_type": "authorization_code",<br />
"redirect_uri": redirect_uri,<br />
<strong>"scope": "offline_access",</strong><br />
}</p>
<p dir="auto">We tried adding the scope=offline_access in order to get a refresh token but we still don't get one.</p>
<p dir="auto">If we try retrieve_refresh_tokens() the result is empty.</p>
<p dir="auto">On the other hand if we use:<br />
exchange_user_credentials_for_access_token()<br />
we get an access_token <strong>and</strong> a refresh token.</p>
<p dir="auto">What are we doing wrong? We need to use to grant_type=authorization_code for our application.</p>
]]></description><link>https://fusionauth.io/community/forum/topic/62/no-refresh-tokens-from-grant_type-authorizazion_code-python</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Jul 2026 22:32:12 GMT</lastBuildDate><atom:link href="https://fusionauth.io/community/forum/topic/62.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 May 2020 14:03:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to No Refresh Tokens from grant_type = authorizazion_code; python on Mon, 11 May 2020 16:17:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi folks,</p>
<p dir="auto">So you need to make sure you request the <code>scope</code> of <code>offline_access</code> in your first request to FusionAuth. That is in the initial request to the <code>authorize</code> endpoint:</p>
<p dir="auto"><a href="http://localhost:9011/oauth2/authorize?client_id=64cbd582-9668-4a93-ad1f-28a78c6b95d3&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000&amp;response_type=code&amp;scope=offline_access" rel="nofollow ugc">http://localhost:9011/oauth2/authorize?client_id=64cbd582-9668-4a93-ad1f-28a78c6b95d3&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000&amp;response_type=code&amp;scope=offline_access</a></p>
<p dir="auto">When you are calling back for the token in your python call, you shouldn't need to specify the scope, it will already be associated with the code that FusionAuth has returned:</p>
<pre><code>from fusionauth.fusionauth_client import FusionAuthClient
import json

code='XspK6zjeqSvXYlkHxrYChBdHM2-nmIjjI8DzbNLGgps'
client_id='64cbd582-9668-4a93-ad1f-28a78c6b95d3'
redirect_uri = 'http://localhost:3000'

client = FusionAuthClient('APIKEY', 'http://localhost:9011')

token = client.exchange_o_auth_code_for_access_token(code,redirect_uri, client_id)

print(json.dumps(token.success_response))
print(json.dumps(token.exception))
print(json.dumps(token.status))
</code></pre>
<p dir="auto">I see the refresh token in the response using this code.</p>
]]></description><link>https://fusionauth.io/community/forum/post/140</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/140</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Mon, 11 May 2020 16:17:52 GMT</pubDate></item><item><title><![CDATA[Reply to No Refresh Tokens from grant_type = authorizazion_code; python on Mon, 11 May 2020 17:53:08 GMT]]></title><description><![CDATA[<p dir="auto">Great thanks, that solved it.</p>
]]></description><link>https://fusionauth.io/community/forum/post/151</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/151</guid><dc:creator><![CDATA[sven.richter86]]></dc:creator><pubDate>Mon, 11 May 2020 17:53:08 GMT</pubDate></item><item><title><![CDATA[Reply to No Refresh Tokens from grant_type = authorizazion_code; python on Mon, 11 May 2020 16:17:52 GMT]]></title><description><![CDATA[<p dir="auto">Hi folks,</p>
<p dir="auto">So you need to make sure you request the <code>scope</code> of <code>offline_access</code> in your first request to FusionAuth. That is in the initial request to the <code>authorize</code> endpoint:</p>
<p dir="auto"><a href="http://localhost:9011/oauth2/authorize?client_id=64cbd582-9668-4a93-ad1f-28a78c6b95d3&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000&amp;response_type=code&amp;scope=offline_access" rel="nofollow ugc">http://localhost:9011/oauth2/authorize?client_id=64cbd582-9668-4a93-ad1f-28a78c6b95d3&amp;redirect_uri=http%3A%2F%2Flocalhost%3A3000&amp;response_type=code&amp;scope=offline_access</a></p>
<p dir="auto">When you are calling back for the token in your python call, you shouldn't need to specify the scope, it will already be associated with the code that FusionAuth has returned:</p>
<pre><code>from fusionauth.fusionauth_client import FusionAuthClient
import json

code='XspK6zjeqSvXYlkHxrYChBdHM2-nmIjjI8DzbNLGgps'
client_id='64cbd582-9668-4a93-ad1f-28a78c6b95d3'
redirect_uri = 'http://localhost:3000'

client = FusionAuthClient('APIKEY', 'http://localhost:9011')

token = client.exchange_o_auth_code_for_access_token(code,redirect_uri, client_id)

print(json.dumps(token.success_response))
print(json.dumps(token.exception))
print(json.dumps(token.status))
</code></pre>
<p dir="auto">I see the refresh token in the response using this code.</p>
]]></description><link>https://fusionauth.io/community/forum/post/140</link><guid isPermaLink="true">https://fusionauth.io/community/forum/post/140</guid><dc:creator><![CDATA[dan]]></dc:creator><pubDate>Mon, 11 May 2020 16:17:52 GMT</pubDate></item></channel></rss>