2 Replies Latest reply on Jun 30, 2017 12:50 AM by groupclaes

    OPTIONS Request return 404 PhonegapBuild API

    groupclaes Level 1

      I'm trying to build a kind of web-portal for all our apps.

      What I'm trying to achieve is the following:

       

      Get all the current apps i have on phonegap

       

      with an ng-repeat i will display all the apps on the home page

       

      when the banner image of the app is cliecked i want to go to a details page of the app showing build status for all 3 platforms, download button and the qr code and an option to mail the download url and qr to employees.

       

      the requests I need to make to the api are:
      https://build.phonegap.com/api/v1/apps
      https://build.phonegap.com/api/v1/apps/:id

      https://build.phonegap.com/api/v1/apps/:id/:platform

       

      no matter what request I make it fails when the preflight OPTIONS request has been send.

       

      16:20:51.570 angular.js:12587 OPTIONS https://build.phonegap.com/api/v1/me 404 ()

      16:20:51.570 (index):1 XMLHttpRequest cannot load https://build.phonegap.com/api/v1/me. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 404.

       

      Authentication header is provided and the code is as follows:

      init(http) {

       

           /* groupClaes_appPortal */

           http.get(`https://build.phonegap.com/api/v1/me`, {

                headers: {

                     'Authorization': 'Basic BASE64_USER:PASS_HERE',

                     'Cache-Control': 'no-cache',

                     'Content-Type': 'text/plain'

                }

           }).then(response => {

                console.log(response);

                this.apps = response.data;

           }).catch(err => {

                console.log(err);

           });

      }