Null Reference Error with BoxJWTAuth.GetToken()
See original GitHub issue- [✔️] I have checked that the [SDK documentation][sdk-docs] doesn’t solve my issue.
- [✔️] I have checked that the [API documentation][api-docs] doesn’t solve my issue.
- [✔️] I have searched the [Box Developer Forums][dev-forums] and my issue isn’t already reported (or if it has been reported, I have attached a link to it, for reference).
- [✔️] I have searched [Issues in this repo][github-repo] and my issue isn’t already reported.
Description of the Issue
I have also submitted a ticket to Box Support with this issue, Case #2235661 Background: We were not experiencing this issue until August 20, 2020. After that point, authentication fails for about 1/3 of our users. The failure is not consistent, so one user will have the error for several hours or days, and then be able to use the same API calls without any error. This error does not occur with version 3.21 and earlier, so I believe something in pull #631 is causing this issue along with whatever changed with the authentication around August 20th.
Error Description: Box.V2.JWTAuth.BoxJWTAuth.AdminToken() sometimes returns a null reference error. It does not return an error for everyone, but once it starts it will continue to give an error to that specific user for several hours or days.
Steps to Reproduce
Here is the full code that is causing the error. The config.json file was generated by our Box app and we’ve been using it for over a year without issue. The error occurs on the last line.
FileStream fs = new FileStream("config.json", FileMode.Open, FileAccess.Read, FileShare.Read);
IBoxConfig config = BoxConfig.CreateFromJsonFile(fs);
BoxJWTAuth auth = new BoxJWTAuth(config);
return auth.AdminToken();
Expected Behavior
Return a valid authentication token.
Error Message, Including Stack Trace
Object reference not set to an instance of an object at Box.V2.JWTAuth.BoxJWTAuth.GetToken(String subType, String subId) at Box.V2.JWTAuth.BoxJWTAuth.AdminToken()
Versions Used
3.21: No problems 3.22 - 3.24: Error described above.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:24 (10 by maintainers)
Top GitHub Comments
I’ve tried it out on half a dozen PCs this morning, but I can’t get the authentication to fail on any of them. It seems to have fixed itself?
I have an application that runs daily and takes advantage of some of the more recent changes to the SDK. User-run applications can stay on 3.21 for now, and I’ll keep watching the logs of the daily application on 3.24 to see if it fails again.
@danielledetennis this has been released! Thanks for your patience!