Environment: C# / Visual Studio 2017, Box.V2 SDK via NuGet, latest version as of today. Company enterprise account of Box.com, I'm the admin.
I've created an "Enterprise Integration" app in Box's developer console, and given it all the privileges available. I set it for "OAuth 2.0 with JWT (Server Authentication)", generated a public/private keypair, and downloaded a JSON of all of it (in the app's executable directory as "BoxAuth.json" (Yes, in my final version, I'll encrypt.)
Trying to follow a quick-start guide here:
So I have this code:
var config = BoxConfig.CreateFromJsonFile(File.OpenRead("BoxAuth.json")); var session = new BoxJWTAuth(config); //client impersonating "me." var user = "***email address removed for privacy***"; var userToken = session.UserToken(user); var userClient = session.UserClient(userToken, user); // client with permissions to manage application users var adminToken = session.AdminToken(); var adminClient = session.AdminClient(adminToken);
When I call session.UserClient(userToken, user), I get an exception: "The API returned an error [BadRequest]"
If I comment that line out, I get an identical exception when I call session.AdminClient(adminToken)
Am I missing something obvious?
Thank you all for any insights.
Please sign in to leave a comment.