On April 27, 2024, our Sign-in and Create Account options will be unavailable from 9am-12pm ET. During this maintenance window, developer account access and free trial registration will be unavailable.

OpenText Rest Api Error

Migrateduser
edited 2023 16 in Hackathon #1

Error : Access to XMLHttpRequest at 'http:///api/v1/auth' from origin 'http://localhost:3002' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

While calling OpenText Rest Api throwing above error using below code :

var otcsticket = '';
$.ajax({
        // Authenticate is a POST
        type: "POST",
        url: "http:///api/v1/auth",
        data: { username: "user", password: "password" },
        beforeSend: function (xhr) {
            // Set the correct MimeType for the request.
            xhr.overrideMimeType("application/x-www-form-urlencoded")
        }
    }).done(function (data) {
        var val = JSON.parse(data);
        alert("setting otcsticket to: " + val["ticket"]);
        // Store the ticket for later use.
        otcsticket = val["ticket"];
    }).fail( function( error ) {
console.log(error)
alert("Bad thing happened! " + error.statusText);
});

  • Any suggestion
  • Any server end setting to allow CORS ?

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.