question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:24 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
danielledetenniscommented, Aug 31, 2020

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.

0reactions
PJSimoncommented, Oct 20, 2020

@danielledetennis this has been released! Thanks for your patience!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Box.V2.JWTAuth.BoxJWTAuth.GetToken throws ...
AdminToken()" is throwing a NullReferenceException. I am using Visual Studio 2015, target .NET framework is 4.6. The API is served by Box.
Read more >
JWT: not able to get access token
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at Box.V2.JWTAuth.BoxJWTAuth.GetToken( ...
Read more >
.NET Core 3 ClaimTypes.Name returning Object Null ...
However my GetUserIdFromToken() function is throwing an Object Not Set to Instance of an Object Null Reference error.
Read more >
How can I fix the error: System.NullReferenceException
NullReferenceException : 'Object reference not set to an instance of an object.' ... I am getting error on this statement: rentTextBox.
Read more >
Object Reference Not Set to an Instance of an Object
This infamous and dreaded error message happens when you get a NullReferenceException. This exception is thrown when you try to access a member—for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found