Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Using previously retrieved refresh token to get next token

Hi, 

I'm facing the situation where I need to use previously retrieved refresh_token  to ask for new revresh token in Jira Tempo data query. 

Script below works fine in case I enter refresh token manually (line- refresh_token = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],)

In real world it should change dynamically so that previously retrieved refresh token is used to ask next one. 

I tried to substitute this line with reference to relevant field in the same table (  refresh_token = Q2{4}[Value],  Q2 is query name) and during this I will get error "Expression.Error: A cyclic reference was encountered during evaluation." - what is understandable as I refer to the same table.

 

Any ideas how to resolve this issue? I have not find any way to store this value separately in Power Query or in Parameters. Any way of using variables here?

 

__________________________________________________________________________________________________

let
url = https://api.tempo.io/oauth/token/,
headers = [#"Content-Type" = "application/x-www-form-urlencoded", #"Accept" = "*/*"],

postData = [grant_type = "refresh_token",
client_id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
client_secret = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
redirect_uri = https://cccccccccc.ee,
refresh_token = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"],

response = Json.Document(Web.Contents(url,
[
Headers = headers,
Content = Text.ToBinary(Uri.BuildQueryString(postData))
])),
#"Converted to Table" = Record.ToTable(response)
in
#"Converted to Table"

____________________________________________________________________________________________

 

1 REPLY 1
lbendlin
Super User
Super User

Neither Power BI nor Power Query have any memory.  Whenever you hear them say "variable" or "parameter" you need to mentally translate that as "immutable constant"

 

The only way I know how to handle this is to brute force it and ask for the initial token over and over again, completely ignoring the refresh tokens.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors