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

Get Fabric certified for FREE! Don't miss your chance! Learn more

Reply
cb12
New Member

REST API 403 Forbidden after 1 hour

Hi,

 

I have written a fairly simple .NET application to POST rows continually to a dataset. This works absolutely fine and I couldn't be happier with the performance of the API either. However, I have an annoying issue where after 60 minutes I start to continually get 403 forbidden responses to my requests. This must be due to my access token expiring, but 1 hour seems like an awfully short period of time for this to start happening. Is this expected behaviour? I've seen other people mentioning needing to retrieve a new token every few days, but no one suggesting they have to do so every hour!

 

Thanks

 

CB

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@cb12

The token expiration is an AAD behavior and 60 minutes seems by default. Check Configurable Token Lifetimes in Azure Active Directory. For further question on AAD, you'd get better response from the dedicated forum.

 

By the way, how did you call the REST API to push data? Can you send the request with a new generated token always?

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@cb12

The token expiration is an AAD behavior and 60 minutes seems by default. Check Configurable Token Lifetimes in Azure Active Directory. For further question on AAD, you'd get better response from the dedicated forum.

 

By the way, how did you call the REST API to push data? Can you send the request with a new generated token always?

ah, yes. thank you! So simple.

 

To answer your question, my application starts up and calls a method to get the token once at the start and then passes that into each subsequent request. I could change this to generate a token each time, but I'm trying post data ~once every 2 seconds and that seems like a lot of unnecessary overhead. Also, this is just a dev solution at the moment ad so the account I'm using has MFA enabled. We could extend the lifetime default to a day, but either way just rewrite the code to catch the forbidden exception and generate a new token. Thanks for your help 🙂

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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