I was testing JWT authentication using my sample console app and at some point I realized that my access tokens are not being expired. I thought they should expire after 60 minutes.
For my surprise, later I discovered that I can pass ANY text as token and it still works. Is it because my app is created within the same Enterprise it tries to access? Why it works with any string?
Sample code
// Read the config with client id, secret, public/private keys from the JSON file
IBoxConfig config;
using (var configStream = File.OpenRead(configJsonPath))
config = BoxConfig.CreateFromJsonFile(configStream);
// Authentication code
xJWTAuth boxJwtAuth = new BoxJWTAuth(config);
//string adminToken = boxJwtAuth.AdminToken(); // COMMENTED OUT!
string adminToken = "ANY STRING"; // WHY THIS WORKS?
// Retreive the list of users - works!
BoxClient adminClient = boxJwtAuth.AdminClient(adminToken);
BoxCollection<BoxUser> boxUsers = adminClient.UsersManager.GetEnterpriseUsersAsync().Result;
Question
With JWT authentication any token grabs data from my Enterprise account
Sign up
Already have an account? Login
Community access is available only with a Box Account.
Sign in with your Box AccountSign in to the Box Community
No account yet? Create an account
Community access is available only with a Box Account.
Sign in with your Box AccountEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
