Skip to main content
Question

.NET SDK - AdminToken() generates 'invalid grant'

  • May 21, 2025
  • 2 replies
  • 48 views

Forum|alt.badge.img

Using .NET Core, following the sample code.  This part works fine without errors:

 

config = ConfigureBoxApi();
session = new BoxJWTAuth(config);

 

But as soon as I call AdminToken() on 'session' I get an 'invalid grant' error:

 

var adminToken = session.AdminToken();

 

generates:

{"error":"invalid_grant","error_description":"Current date\/time MUST be before the expiration date\/time listed in the 'exp' claim"}

 

Since I can't manipulat ethe 'exp' claim, I'm stuck here.

Any solutions?

 

2 replies

Forum|alt.badge.img

Forum|alt.badge.img

Based on that I noticed that the clock was of on my Visual Studio machine.  Once I sync'd the time and ran the code again I was able to make it work.  Thanks!