Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Box.V2.JWTAuth.BoxJWTAuth.GetToken throws NullReferenceException (.NET)

Answered
New post

Comments

2 comments

  • jcleblanc

    Hi ,

     

    Off hand I don't see anything anything directly wrong with the code, as this is what I'm using for my C# code:

     

    // Configure Box SDK instance
    var reader = new StreamReader("config.json");
    var json = reader.ReadToEnd();
    var config = BoxConfig.CreateFromJsonString(json);
    var sdk = new BoxJWTAuth(config);
    var token = sdk.AdminToken();
    BoxClient client = sdk.AdminClient(token);

     

    The one thing that I can say is it might be worth making sure that the content of your .json file is correct (should be directly downloaded from the Box app and not modified in any way) and that it's actually being read in correctly.

    0
    Comment actions Permalink
  • ronnysh

    Thanks, I figured it out - the app needed to be submitted for authorization.

    0
    Comment actions Permalink

Please sign in to leave a comment.