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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
mohit_pawar
New Member

Authentication error while log in

#Set parameters

client_id = "" #Add your Client ID here
client_secret = "" #Add your Client Secret here
tenant_name = "" #Add your tenant name here
workspace_id = "" #Add your Workspace ID here
dataset_id = "" #Add your Dataset ID here

authority_url = "https://login.microsoftonline.com/" + tenant_name 
url = "https://api.powerbi.com/v1.0/myorg/groups/" + workspace_id +"/datasets/"+ dataset_id +"/refreshes?$top=1"
 
app = msal.ConfidentialClientApplication(client_id, authority=authority_url, client_credential=client_secret)
result = app.acquire_token_for_client(scopes=scope)
 
Hi Team,
I trying to log in to account with the above python script for refresh dataset with that script. For that I am trying to log in but facing an aythentication error message like 'error': 'unauthorized_client',
 
want to clear that please guide me in this.
 
Thanks,
Mohit P
 
 
 
2 REPLIES 2
tayloramy
Community Champion
Community Champion

Hi @mohit_pawar
I wanted to check in here and see if you still needed any help, or if my previous post was able to solve your problem? 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, please mark this as the solution. 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.
tayloramy
Community Champion
Community Champion

Hi @mohit_pawar

 

Does this service principal have access to the workspace? 
In the Fabric Admin portal, is the "Service principals can use Fabric APIs" enabled? 

 

If you found this useful, consider giving Kudos. If I solved your problem, mark this post as the solution. 

 

If you found this helpful, consider giving some Kudos. If I answered your question or solved your problem, mark this post as the solution.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.