Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,187
Community Members
 
Community Events
185
Community Groups

CSP error on rest api by plugin

Hi,
I'm developing a Custom UI plugin through Forge for Confluence Cloud.

When I attempt to make some rest call from plugin to Confluence I get:
 Refused to connect to 'https://<environment>.atlassian.net/wiki/rest/api/template/page' because it violates the following Content Security Policy directive: "connect-src 'self'".


Do you have any idea of what problem could be?

 

project_structure.PNG


App.js

import React, { Component } from 'react';
//import { invoke } from '@forge/bridge';
import {ExcelRenderer} from 'react-excel-renderer';
import axios from 'axios';

class App extends Component {

  constructor(props) {
    super(props);
    this.state = { cols: null, rows: null };
  }

  /*useEffect(() => {
    invoke('getText', { example: 'my-invoke-variable' }).then(setData);
  }, []);*/

  componentDidMount() {

    console.log(' COMPONENT DID MOUNT START');

              { headers: { Authorization: 'Basic <API TOKEN ENCODED BASE 64>',
                           Accept:  'application/json',
                           'Content-Security-Policy': 'script-src skyoffermanagement.atlassian.net'} })
    .then(response => {
      console.log(
        `Response: ${response.status} ${response.statusText}`
      );
      console.log(response.text());
    })
    .catch(err => console.error(err));

  }

  fileHandler = (event) => {
    let fileObj = event.target.files[0];

    ExcelRenderer(fileObj, (err, resp) => {
      if(err)console.log(err);            
   
      else{
        console.log('ExcelRender response: ', resp);

        for( let i=1; i < resp.rows.length; i++){
   
        }

      }
    });            
  }

  render(){
    return (
      <div>
        <input type="file" onChange={this.fileHandler.bind(this)} style={{"padding":"10px"}} />
      </div>
    );
  }

}

export default App;


manifest.yml

modules:
  macro:
    - key: excel-proposal
      resource: main
      resolver:
        function: resolver
      title: excel-proposal
      description: Component to upload excel proposal
  function:
    - key: resolver
      handler: index.handler
resources:
  - key: main
    path: static/fe/build
app:
  id: ari:cloud:ecosystem::app/cd8b9860-3f91-4012-89a7-b6b8d20e37c3
permissions:
  scopes:
    - 'read:confluence-content.summary'
  content:
    scripts:
    - 'unsafe-inline'  

1 answer

0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 27, 2021

Hi @Riccardo Atzeni

Welcome to the community.  I recommend you also post this question in the dev community for a faster response. 

Good Luck

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events