Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

CORS Issue on uploading files to Workfront API using Firefly app

Avatar

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

173 likes

Total Posts

323 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

173 likes

Total Posts

323 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile
shelly-goel
MVP

05-05-2021

Getting below error even though appropriate headers are set

 

Access to fetch at '<workfront url>/attask/api/v12.0/upload' from origin 'https://localhost:9080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

 

headers being set:

headers: {
        'apiKey': '<key>',
        'Content-Type': 'multipart/form-data',
        'Access-Control-Allow-Origin': '*'
      }

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Boost 25
Employee
duypnguyen
Employee

Likes

27 likes

Total Posts

162 posts

Correct Reply

31 solutions
Top badges earned
Boost 25
Applaud 5
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Boost 25
Employee
duypnguyen
Employee

Likes

27 likes

Total Posts

162 posts

Correct Reply

31 solutions
Top badges earned
Boost 25
Applaud 5
Give Back 5
Give Back 3
Give Back 10
View profile
duypnguyen
Employee

05-05-2021

@shelly-goel - the CORS policy is set by the server (workfront in this case), and you can not bypass it by changing your UI code.

The recommended route would be: write a Runtime action to call the workfront API, processes the data, and returns it to the UI for rendering.