Forum Discussion

PowerbiStarter's avatar
PowerbiStarter
New Member
8 years ago
Solved

Secure write back possible in custom visual?

Hi PowerBI community,

I have a question:
- Is it possible to -in a secure way- implement write back functionality in PowerBI using custom visuals?
- if so, how?
- if not, please explain what the blocking piece is

Details
- please note that I have already a working .pbiviz that does write back functionality (it can call an external api using jQuery). I have verified that I was able to post datapoints from powerbi to this api that is hosted on a different server

Only question is security related
- Now this external api is “open”: no authentication required
- My question is if (and how) I can authenticate myself against this external api so only authenticated users in PowerBI can call the apu

Use case
- we have a clients that have this requirement, and are flexible in how to exactly organize this

Please let me know what is (or is not) possible

Thanks!
  • v-viig's avatar
    v-viig
    8 years ago

    Authentication is on backlog. It'll be considered soon.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

12 Replies

  • v-viig's avatar
    v-viig
    Community Champion

    Power BI CV API does not provide authentication mechanism so far.
    We'd recommend to implement your own authentication that will ask user to log in.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

    • PowerbiStarter's avatar
      PowerbiStarter
      New Member
      Thanks for the reply.

      It is not the answer I hoped for (user-experience-wize), but it is clear at least.

      Also I hope this will soon be implemented; in Qlik and some other data visualization tools you have ways to do this, and I see these kinds of requests more and more...
      • v-viig's avatar
        v-viig
        Community Champion

        Authentication is on backlog. It'll be considered soon.

         

        Ignat Vilesov,

        Software Engineer

         

        Microsoft Power BI Custom Visuals

        [email protected]

  • nivasnalla's avatar
    nivasnalla
    Frequent Visitor
    If possible, could you please share the code snippet used to call the external API. I am finding hard to make it work.
    • v-viig's avatar
      v-viig
      Community Champion

      You just need to produce an AJAX call to remote server via request, jquery, or other libraries.

       

      Ignat Vilesov,

      Software Engineer

       

      Microsoft Power BI Custom Visuals

      [email protected]

      • nivasnalla's avatar
        nivasnalla
        Frequent Visitor

        // inside the custom visual contructr

        document.body.innerHTML = '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>'
        +'<input id="txtname" type="text" /></p>'
        +'<input id="InsertRecord" type="button" value="Insert"></input>'

        let bttnClick = document.getElementById("InsertRecord");
        bttnClick.addEventListener("click", (e: Event) => this.getCall());

        // out side the constructor and inside the visual class

        getCall(){

        $(function() {
        $.getJSON("https://api.ipify.org?format=jsonp&callback=?",
        function(json) {
        document.write("My public IP address is: ", json.ip);
        console.log(json.ip)
        }
        );
        });
        }

         

        I used the above to call an web api that returns the public IP to console and I am getting the below error

         

        API Reference : https://www.ipify.org/

         

        Uncaught TypeError: $ is not a function
        at Visual.getCall (<anonymous>:627:25)
        at HTMLInputElement.<anonymous> (<anonymous>:614:89)

         

        I might be missing jquery reference somewhere, but I couldn't figure it out. Any help would be greatly appreciated, thanks in advance.