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
danielamengual
Frequent Visitor

Need to connect to API that requires OAuth2

Hi,

 

I'm trying to connect to write a query to connect to an API where I need to login and get a token, to then get access to the data. I'm not super familiar with M or with writing queries in general, I've mainly dealt with SQL connections and other simple connections that I've edited by transforming in Power Query. I connected to an API once, and it was through a url and key and that's it. 

 

From my research and multiple test runs that lead to nothing (i'm not crying, you are), is it necessary to create a custom connector, or is this something that can be done through a blank query? I'm not opposed to creating a connector, but before I go down that route, I want to know if it's absolutely necessary or if I'm overcomplicating this.

 

Any response is greatly appreciated !! 🙂

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @danielamengual 

You can try to refer to the following link to connect the api by OAuth2

powerbi - Private REST API connection Power BI (M - Power Query) - Stack Overflow

Chris Webb's BI Blog: Connecting To REST APIs With OAuth2 Authentication In Power Query/Power BI (cr...

But it better to use custom connector ,because when you write it directly by M, the safety will be affected. the following link is about use custom connector.

Power Query SDK overview - 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.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @danielamengual 

You can try to refer to the following link to connect the api by OAuth2

powerbi - Private REST API connection Power BI (M - Power Query) - Stack Overflow

Chris Webb's BI Blog: Connecting To REST APIs With OAuth2 Authentication In Power Query/Power BI (cr...

But it better to use custom connector ,because when you write it directly by M, the safety will be affected. the following link is about use custom connector.

Power Query SDK overview - 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.

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