October 18, 2022

Dataverse REST Builder available as Browser Extension

Today (18 October 2022) I did a session at WPC 2022 about Dataverse Web API and I announced that Dataverse REST Builder is now available as browser extension for Google Chrome and Microsoft Edge, here the links if you are interested:

Chrome Web Store

Microsoft Edge Add-ons

Big thanks to my friend Natraj Yegnaraman for suggesting me the idea, his "Level up for Dynamics 365/Power Apps" extension is well known to Dynamics 365/Power Apps users.

How it works Dataverse REST Builder Browser Extension? After you click on the extension icon you are prompted to enter the Environment URL in order to get the Access Token:

After you authenticate, Dataverse REST Builder is loaded in the same way as the XrmToolBox, Managed Solution and Dataverse DevTools versions.

How Dataverse REST Builder is able to obtain the Bearer Token in this scenario? It uses the same Application Client ID defined inside the Microsoft documentation in order to work with Postman: Set up a Postman environment

This Client ID allows two callback URLs, https://localhost and https://callbackurl, inside a browser extension we are able to obtain the URL return after the authentication process is completed (the token is one of the parameters), similar of what Postman does (maybe you don't remember but Postman started as a browser extension).

This solved the main problem, running Dataverse REST Builder inside an extension was indeed possible and doesn't require me to register an Azure application that maybe needs to be whitelisted by your organization, it uses a Microsoft Application Client ID.

The other problem was the use of eval() function to execute the generated code (keep in mind that for generating just the code eval() is not used). Browser extensions stop eval() due to security concerns, however with V3 specifications there is a possibility to load a page inside a sandbox (details here) allowing the use of eval(), so you can execute the generated code as well (Xrm.WebApi still works only with the Managed Solution version).

This is also the reason why there isn't a Firefox extension, Firefox extensions still use V2 specifications and there isn't a concept of sandbox. If in the future they allow this approach I think I can release DRB for Firefox too.

The Browser Extension version can be improved (I have already some ideas), let's see what the future brings.

During the next days I will update the other versions to match the version number (the Browser Extension currently shows 1.0.0.40) and publish the code to a separate GitHub repository.

I hope you find this version useful.

0 comments:

Post a Comment