Skip to main content

I am just getting started with the .Net SDK, using .Net Core 3.1 (VS2019). Have set up the app, jwt, oath, and the boxJWT var is created/populated without issue. Am encountering an error on the 2nd line.

 

var boxJWT = new BoxJWTAuth(configFromFile);
var adminToken = boxJWT.AdminToken(); //Breaks here

 

The root error occurs on this line in the Box.V2 SDK:
BoxJWTAuth.cs
string assertion = tokenHandler.WriteToken(token);

 

Error Info:
NotSupportedException: Method not supported. System.Security.Cryptography.RSA.DecryptValue(bytey] rgb)

 

Box.V2.JWTAuth.BoxJWTAuth.ConstructJWTAssertion(string sub, string boxSubType, Nullable nowOverride) in BoxJWTAuth.cs
string assertion = tokenHandler.WriteToken(token);


Box.V2.JWTAuth.BoxJWTAuth.GetToken(string subType, string subId) in BoxJWTAuth.cs
var assertion = ConstructJWTAssertion(subId, subType);


Box.V2.JWTAuth.BoxJWTAuth.AdminToken() in BoxJWTAuth.cs
return this.GetToken(ENTERPRISE_SUB_TYPE, this.boxConfig.EnterpriseId);


BoxAPIdnc3.1_v1.Controllers.BoxTestController.GetAsync() in BoxTestController.cs
var token = sdk.AdminToken();


The Box.V2 build is .Net 4.5, so it should work? - MS doc - RSA.DecryptValue(ByteB]) Method

 

I've obviously done something wrong as at least one other user has it working.

Please advise - thanks in advance!


The VS2019 solution originally pointed to the box-windows-sdk-v2 DLL as a reference. Removed the reference and instead installed the .Net Core package via Nuget and it worked.

FYI - next issue was not being able access my test/dev account via boxJWT.UserToken(appUserID) .. that issue was resolved by re-authorizing the app.



Reply