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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rajulshah
Super User
Super User

Refreshed Token using UsernamePassword Authentication Type

Hello everyone,

 

In my custom connector, I am using UsernamePassword AuthenticationType, where Username = ClientId and Password = Client Secret. And using these, we are getting accesstoken.  Can anyone let me know how do we get the refreshed token after it expires in this case? 

@artemus Any guidance would be helpful.

Thanks.

6 REPLIES 6
artemus
Employee
Employee

IF you are using Username and password to get an access token, then your token will need to be fetched every time the connector is invoked. Oauth authentication supports refreshing a token.

 

In theory you could cache the access token, but this is rather complex, and only good if you have a short duration token and there are multiple invocations of your connector in a single session.

@artemus 
How can we cache the access token? Can you show how can we implement this?

First, do you really need a cache over just getting a fresh token every time? The technique for getting a refreshable token I haven't actually seen used before as it requires a key that corrsponds to the time window in which the token is valid for, and only useful if your token can expire between requests in the same dataflow.

 

Unless you have a very special case, just get a fresh token when your connector is invoked using the 

Extension.CurrentCredential() function.

@artemus Thanks for the response.
We'll surely try that.

 

Do we have any function that clears the cache?

Or anyone if that has experience getting the refreshed token using UsernamePassword credential?

@artemus Any updates on this?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors