I'm trying to use the .NET SDK in my console application to upload a file to the box that is dynamically generated each day. I'm confused on the OAuth process. I've set up my OAuth2 application, and got the id, secret, and redirect_uri
var config = new BoxConfigBuilder(clientId, clientSecret, new Uri(redirect_uri)).Build();
var client = new BoxClient(config);
I try to make a web request to get the authorization code:
var rq = (HttpWebRequest)WebRequest.Create(config.AuthCodeUri);
HttpWebResponse rs = rq.GetResponse() as HttpWebResponse;
but it doesn't return a code in the body. Instead, it returns the HTML of the Grant Access page (as detailed in https://developer.box.com/guides/authentication/oauth2/with-sdk/). But this is a console app, there is no user to click "Grant Access" - I need to just get the actual auth code that I use within my code, without requiring and manual user steps. How do I get this code?