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

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

Reply
Anonymous
Not applicable

How to authenticate with a custom API in a custom connector, and store tokens for future API request

I'm having a very hard time finding any examples for my use case which I find surprising. I have an endpoint like "www.myCompany/login" that takes a username, password, and user type as a json array and returns a token. That token is used in subsequent requests to other endpoints to retrieve data from the API. Are there any examples for this use case out there?

 

Thanks,

Conor

1 REPLY 1
SteveCampbell
Memorable Member
Memorable Member

Hopefully this pattern can help get you started. You would need to finish to extract the info you need and maybe add headers / body and probably some edits depending how your data is returned

let
  token_header = [ 
#"Content-Type" = "application/json",
#"Accept" = "*/*"
],

  token_content = [
#"grant_type" = "client_credentials",
#"client_id" = #"clientid",
#"client_secret" = #"secret"
   ],

  AccessTokenCall = (Web.Contents("https://XXX.com/v1/oauth2/token", [Headers =   token_header, Content = Json.FromValue(token_content)])),
  AccessToken= Json.Document(Source, 1252),
  
   Headers=[
   #"Authorization" = "Bearer " & AccessToken ,
   #"Content-Type" = "application/json"
		 ],
    
	APICall = Web.Contents("https://XXX.com/v1/oauth2/token", [Headers =   Headers])

 



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



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