<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Refresh Token Expiry in Data Engineering</title>
    <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4243468#M4618</link>
    <description>&lt;P&gt;Unfortunately nothing is working, on scheduled job , the token is getting expired around 63-66 min mark (with 90 min timeout session default). I am also not sure if you can defualt a notebook to run with a HC mode. I can only turn on HC mode when inside it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is probably because, if I follow &lt;A href="https://community.fabric.microsoft.com/t5/Developer/REST-API-Get-Access-Token/m-p/1898039/highlight/true#M29951" target="_self"&gt;this&lt;/A&gt; , I get&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "token_type": "Bearer",
    "expires_in": 3599,
    "ext_expires_in": 3599,
    "access_token": "loremIpsum"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I refresh this token or get access to a reresh token that can be used to API calls nearing 60 min mark&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2024 17:17:21 GMT</pubDate>
    <dc:creator>smpa01</dc:creator>
    <dc:date>2024-10-15T17:17:21Z</dc:date>
    <item>
      <title>Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234032#M4500</link>
      <description>&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/29835" target="_blank" rel="noopener"&gt;@peggysue&lt;/A&gt; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/135"&gt;@gbrueckl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have been runing batch jobs and the token is getting expired ~60/75 min.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// header
&amp;lt;CIMultiDictProxy('Content-Length': '104', 'Content-Type': 'application/json; charset=utf-8', 'X-PowerBI-Error-Info': 'TokenExpired', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'X-Frame-Options': 'deny', 'X-Content-Type-Options': 'nosniff', 'Access-Control-Expose-Headers': 'RequestId,X-PowerBI-Error-Info', 'RequestId': 'f098269c-d1b1-473f-86ae-3da25c0b6555', 'Date': 'Tue, 08 Oct 2024 17:15:34 GMT')&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried &lt;A href="https://community.fabric.microsoft.com/t5/Service/API-with-dynamic-access-token-can-t-refresh-in-Power-BI-service/m-p/3886712/highlight/true#M231353" target="_self"&gt;this&lt;/A&gt; but this is not consistent. I desparately need the bacth job to run without getting terminated in between and without needing me to babysit.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;from datetime import datetime, timezone
import pytz
import requests


def current_hour ():
    current_time = datetime.now(pytz.timezone('America/Toronto'))
    hour = current_time.hour
    text_hour = str(hour)
    return text_hour

token = notebookutils.credentials.getToken('pbi')  

service_call = requests.get(uri, headers={"authorization": "Bearer " + token,"VariableHeader": current_hour()}) &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 18:56:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234032#M4500</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2024-10-08T18:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234382#M4504</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Perhaps you can try to modify the session timeout of the notebook, you can click on the left-bottom session icon to open session information panel.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 609px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1179935i8A4A7C751FF57390/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 02:29:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234382#M4504</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-09T02:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234477#M4506</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp; Thanks for this and I will take this out on a spin and let u know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1 question though - Assuming it works, if I am running batchJob.ipynb with the scheduler at nth hour every day, how can I ensure that it runs with the same custom session timeout (e.g. 90 min) everyday? Asked differently, is the same custom session timeout value applies to the notebook on each run and ca different notebooks have different custom session timeout values ?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 03:23:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4234477#M4506</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2024-10-09T03:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4236443#M4532</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;You can open the workspace setting to modify the spark session timeout.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 848px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1180784i316E48A506A70473/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;In addition, you can also consider to use high concurrency mode to running your notebook:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/fabric/data-engineering/configure-high-concurrency-session-notebooks" target="_blank"&gt;Configure high concurrency mode for notebooks - Microsoft Fabric | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 07:20:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4236443#M4532</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-10T07:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4239171#M4564</link>
      <description>&lt;P&gt;please give me few days to test it out.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 16:52:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4239171#M4564</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2024-10-11T16:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4240790#M4584</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Sure, you can feel free post here if the above not helps.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 07:06:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4240790#M4584</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-14T07:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4242136#M4595</link>
      <description>&lt;P&gt;@Anonymous&lt;/a&gt;&amp;nbsp; if the notebook is run on a schedule, the token expiry still happens. But if I run the notebook is run from while inside it, then the token does not expire. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to run the notebook on a schedule.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 01:31:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4242136#M4595</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2024-10-15T01:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4242588#M4602</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;As you said, it seems like these setting does not enable when you setting schreuder on it. Have you tried to use high concurrency mode to processing your notebook, it should allow to use more resource on it.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 06:34:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4242588#M4602</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-15T06:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4243468#M4618</link>
      <description>&lt;P&gt;Unfortunately nothing is working, on scheduled job , the token is getting expired around 63-66 min mark (with 90 min timeout session default). I am also not sure if you can defualt a notebook to run with a HC mode. I can only turn on HC mode when inside it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is probably because, if I follow &lt;A href="https://community.fabric.microsoft.com/t5/Developer/REST-API-Get-Access-Token/m-p/1898039/highlight/true#M29951" target="_self"&gt;this&lt;/A&gt; , I get&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
    "token_type": "Bearer",
    "expires_in": 3599,
    "ext_expires_in": 3599,
    "access_token": "loremIpsum"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I refresh this token or get access to a reresh token that can be used to API calls nearing 60 min mark&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 17:17:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4243468#M4618</guid>
      <dc:creator>smpa01</dc:creator>
      <dc:date>2024-10-15T17:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Refresh Token Expiry</title>
      <link>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4244103#M4627</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/24978"&gt;@smpa01&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When do you create the Bearer token and do you re-use the Bearer token over multiple notebook sessions? If you do, you may retrieve the Bearer token in every session instead, so you are less likely to exceed the 1h limit of the Bearer token.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 05:38:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Data-Engineering/Refresh-Token-Expiry/m-p/4244103#M4627</guid>
      <dc:creator>FabianSchut</dc:creator>
      <dc:date>2024-10-16T05:38:31Z</dc:date>
    </item>
  </channel>
</rss>

