Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
My company uses Box to store all its files. My PowerBI file references excel documents which are stored on Box.
Currently the work around we are using is to download (or sync) the files to our personal computers and change the source of the data between employees. However, this often means that the latest version of the excel file may not be used to create the PowerBI dashboard.
I have read through the documentation for Box.
First thing I wanted to try was to see if I could access the file and after reading through a lot of the details on https://developer.box.com/, I was able to connect to the excel file using a developer token following directions here: https://developer.box.com/docs/setting-up-a-jwt-app
The M code used is :
let options =[ Headers =[ #"Authorization"="Bearer ******" ] ], Source = Web.Contents("https://api.box.com/2.0/files/*****/content", options), #"Imported Excel" = Excel.Workbook(Source) in #"Imported Excel"
I've blocked out the fileID and the developer token for obvious reasons.
I've since tried to move forward from using the developer token as it only lasts for 1 hour into using the JWT authentication: https://developer.box.com/docs/construct-jwt-claim-manually
which should in theory allow me to connect and access the file.
This is where I am completely lost. I can't figure out how to get the token using this method and I can't even get jwt.io to produce the required token.
I have two ideas at this point.
1. Try and figure out how to proceed with this and hopefully getting the JWT working is not too dificult and someone here can help me out.
2. Try and figure out how to proceed with the BoxSDK (https://developer.box.com/docs/authenticate-with-jwt). However, I do not know how to access any version of the BoxSDK from Power Query as it is not really available for power query.
Has anyone made similar progress or gone further to successfully connect Box to PowerBI?
Perhaps you could use the "Direct Link" (direct download link) feature. It is not available for free personal box.com accounts. You can read more here: https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings
Hi @Anonymous
As i don't have a BOX account, i can't test it with power bi. Maybe the following link can give you some ideas .
Power BI - Get JWT Token from Auth API
Regarding to get token from JWT Application, it isn't the matter from power bi side, you may read this article to know more about JWT.
GET the TOKEN: The token should be present in the header with name jwt-token (you can choose your custom name or send it in authorization header after all it’s custom contract). Also, the best practice is to send it via Authorization Bearer scheme.
Best Regards
Maggie
Hey Maggie,
Thanks, that's helpful, but I still don't know what to do.
How do I get the token? Namely, without the packages used here available for PowerBI: https://developer.box.com/docs/construct-jwt-claim-manually, Can I still get the Bearer token?
Copying the steps from that page,
I have all the information from the json file (Step 1).
I have no idea how I can use Power Query to decrypt the private key (Step 2)
For the JWT assertion, I have no idea how I can create the jti (unique hex code) I believe I should be able to get the unix time from powerBI doing something like this. Once I have that, I still need a way to convert it into the JWT Assertion which for instance in python is done using the "jwt" package. (Step 3)
I'm quite confident steps 4 and 5 will be similar to my first post to achieve.