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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Store access token custom connector

Hi, I am developing a custom connector for retrieving data from an API. The authentication flow was customized, therefore it does not follow a strict standard.

 

The flow is:

1. Ask user for Username and Password

2. API authenticate that user and then it returns an access_token with expiration time.

3. For retrieving data, the access_token must be sent.

 

So, my question is: Is there a way to store that access_token globally as Username and Password are stored in "Extension.CurrentCredential()"?

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Do you connect to data with Power BI Desktop via custom connector?

Or do you embed the Power BI Content into your apps?

 

If you are in first scenario,

when you connect to data, you need to provide the specific credential to retrieve data from the data source.

Does the flow you write above fit for you(report creator) or any users who consume your report?

 

If you are in the second scenario, please read official documents.

Step 2: Get n authentication access token

 

Best Regards

Maggie

 

Anonymous
Not applicable

I connect to data with custom connector.

In the definition of connector, I specified UsernamePassword as my method of authentication. The OAuth flow provided by PowerBI does not fit with my flow, for that reason I defined UsernamePassword as authentication.

 

So, is possible to store that access_token with UsernamePassword authentication?

No. If you've defined the authentication kind as UsernamePassword, then the only fields available to the Extension.CurrentCredential() record are UserName and Password. The access_token field is only available to the record if the authentication kind is OAuth.

 

What kind of OAuth grant type does your API require? Custom connectors should be able to handle the Authorization Code, Implicit, and Client Credentials grant types. Does your API use another grant type?

Anonymous
Not applicable

Client credentials, but I don't want that PowerBI redirect to a another page to sign in.

is there an example for that kind of grant type?

 

Thanks 

I've never done that nor have I seen it implemented. If you search for the terms client_credentials and grant_type on GitHub, you get two hits: one is from my repo where I authenticate to Twitter (not a custom connector) and the other is a repo for a custom connector that authenticates to Microsoft Teams. I don't know if that works, but I would try adapting that for my purposes.

 

Good luck!

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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