This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
Is it possible to update an access token that has expired with a refresh token using the advanced editor/ Power Query M? I ask the following because every time I go in, it asks you to revalidate the credentials and expires. I would like to know if the general idea would work or if I'd run into a dead end. Thanks in advance!
Scenario:
I have an access token from a 3rd party (Caspio) and they have it expire every 24 hours. They give you a refresh token to get a new access token when you'd like to refresh your data.
Can I use an if statement in the advanced editor where I see the general code below (I'm learning Power Query M so I'm kinda pseudo coding):
let
Check = Json.Document(Web.Contents("https://mycaspiodatabase/restapi/", [Headers=[Authorization="bearer myaccesstoken"]])),
Response = Check["Response"],
if Response <> "Active" then myNEWaccesstoken = Json.Document(Web.Contents("https://mycaspiodatabase/restapi/updateToken", [Headers=[Authorization="bearer myrefreshtoken"]])) else Source=Check,
if Response <> "Active" then Source=Json.Document(Web.Contents("https://mycaspiodatabase/restapi/", [Headers=[Authorization="bearer myNEWaccesstoken"]])),
in
Source
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.