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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
arindamp
New Member

Unable to fetch access_token from Extension.CurrentCredential()

Hi experts

I am building a PowerQuery Custom Connector (for Zoho APIs) in Visual Studio to be deployed to Power BI.
While debugging/launching from Visual Studio, I can see the data being fetched from the API; however, if I deploy the connector to the Power BI Custom Connectors folder, the same code doesn't work.
I get an error in Power BI while trying to use the Connector :
Details: "The field 'access_token' of the record wasn't found."

The snippet where I am accessing the token after the OAuth flow -

`...
token = GetToken(),
apiResponse = zoho.CallApi(apiEndpoint, token),
...

GetToken = () =>
let
access_token = Extension.CurrentCredential()[access_token]
in
access_token;

zoho.CallApi = (apiEndpoint as text, accessToken as text) =>
let
// Make API request using the access token
apiResponse = Json.Document(
Web.Contents(
apiEndpoint,
[Headers = [#"Authorization" = "Zoho-oauthtoken " & accessToken]]
)
)
in
apiResponse;
...
zoho = [
Authentication = [
OAuth = [
StartLogin=StartLogin,
FinishLogin=FinishLogin,
Refresh=Refresh,
Logout=Logout
]
]
];

//Implementations for StartLogin, FinishLogin, Refresh and Logout
`



Is there any restriction in invoking Extension.CurrentCredential() from Power BI (December 2023 version)?
The reason I need to fetch the access_token is because the Zoho APIs require the Authorization header to have the value : Zoho-oauthtoken <access_token>

3 REPLIES 3
arindamp
New Member

Any ideas ?

Anonymous
Not applicable

Hi @arindamp 

Please make sure that the access token is right,

e.g 

 

MyConnector.Raw = (_url as text) as binary =>
let
    apiKey = Extension.CurrentCredential()[Key],
    headers = [

        #"x-APIKey" = apiKey,
        Accept = "application/vnd.api+json",
        #"Content-Type" = "application/json"
    ],
    request = Web.Contents(_url, [ Headers = headers, ManualCredentials = true ])
in
    request

 

and you can refer to the following link.

Handling authentication for Power Query connectors - Power Query | Microsoft Learn

 

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous 

The access token name is right, as it all works fine from Visual Studio.
The issue only happens when the Connector has been deployed to Power BI.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors