I'm using the ruby-box gem to connect to box.com, where it states to use this code to get an access token:
session = RubyBox::Session.new({
client_id: $boxClientID,
client_secret: $boxClientSecret
})
authorize_url = session.authorize_url('https://redirect-url-in-app-settings')
@token = session.get_access_token('code-returned-to-redirect_url')
The problem is that I don't have a url to re-direct to, and I'm also not using a GUI, so I can't get the code from there. What do I do?
I'm using python, not ruby, so I can't tell you how to code this, but I can share with you how I've decided to work around this problem.
I'm writing a python script that will watch the events queue on box, and then handle new files as they are uploaded by users.
Because the python script is automated, I am going to the box token generator hosted on heroku (http://box-token-generator.herokuapp.com/) and using that to kick-start authenticating my app. Every time I make a request, I check to see if I get a 401 Unauthorized error, and if I do, I refresh my tokens.