I’ve been trying to redirect to Confluence page from my application using basic authentication.
I was able to retrieve the API using same credentials.
Now the problem is that I cannot redirect to the Confluence page. I keep on getting this error:
“Access to XMLHttpRequest at ‘mypage.atlassian.net/wiki/spaces/RDS/pages/XXXXXXX/Title+of+the+page’ (redirected from ‘localhost:1508/Home’) from origin ‘localhost:1508’ 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.”
My objective:
Redirect to Confluence page on hyperlink click from MyWebsite providing basic authentication. I mean Confluence page not Confluence application.
Is my objective possible?
Here’s the piece of my code:
$.ajax({
type: 'GET',
url: 'https://mypage.atlassian.net/wiki/spaces/RDS/pages/XXXXXXX/Title+of+the+page',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic samplebasicauthentication");
xhr.setRequestHeader("X-Atlassian-Token", "no-check");
xhr.setRequestHeader ("Access-Control-Allow-Origin", "*");
xhr.setRequestHeader("Accept", "*/*");
xhr.setRequestHeader("Cache-Control", "no-cache");
},
success: function (data) {
window.location.replace("https://mypage.atlassian.net/wiki/spaces/RDS/pages/XXXXXXX/Title+of+the+page");
}
});