Forum Discussion

burgerboyy's avatar
burgerboyy
New Member
3 years ago

Privileges settings for Power BI visual not working?

Hi,

 

I'm currently building a custom visual that makes use of the google maps API - as such, I've set privileges in the capabilities.json to allow for WebAccess. However, whenever testing my visual in PowerBI service, I get the following when inspecting the sandbox div:

 

Refused to load the script 'https://maps.googleapis.com/maps/api/js?key=YOUR_KEY' because it violates the following Content Security Policy directive: "default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

 

My understanding is that you need to allow for access to external resources by updating permissions in capabilities.json - here is my code:

 

    "privileges": [{
        "name": "WebAccess",
        "essential": true,
        "parameters": [
            "https://*maps.googleapis.com/","https://*maps.googleapis.com/maps-api-v3/","https://*googleapis.com","https://*google.com","https://*geo0.ggpht.com"
        ]

 

 

However, it seems to make no difference regardless of whether I add the WebAccess privilege or not - I cannot call the external js and get the same console error message. What am I missing here?

1 Reply

  • Hi, Do you solved the problem, I have a similar problem?

     

    I build a custom visual that call a external api with a interval, this is the code:

     

    const response = await fetch("http://localhost:3000",{
                method: 'POST',
                headers: {
                'content-type': 'application/json;charset=UTF-8',
                },
                body: JSON.stringify({
                    data: column_id
                }),
            });
     
    Also add in capabilities.json :
        "privileges": [
            {
                "name": "WebAccess",
                "essential": true,
                "parameters": ["http://localhost:3000"]
            }
     
    It works in development mode, but when i build and package the solution it doesn´t in powerbi desktop. 
     
    The api is program in node with cors enable and listening in port 3000, http:
    app.use(cors({
        origin: '*'
    }));
     
    Thank you for any help.