Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-8769

[fiware-stackoverflow] Fiware KeyRock sending Ajax requests with access token

    Details

      Description

      Created question in FIWARE Q/A platform on 27-10-2015 at 10:10
      Please, ANSWER this question AT https://stackoverflow.com/questions/33364204/fiware-keyrock-sending-ajax-requests-with-access-token

      Question:
      Fiware KeyRock sending Ajax requests with access token

      Description:
      I'm building a client for a FIWARE KeyRock GE instance in Javascript.

      I have a function for querying the instance (after a successful login flow in which I received an access_token):

      keyrockManager.query = function (uri, method, params, callback) {
      if (params == null)
      params = {};
      params.access_token = keyrockManager.getAccessToken();
      $.ajax(
      {
      url: KeyrockConfig.defaultInstanceUrl + uri,
      type: method,
      data: params,
      dataType: "jsonp",
      success: function (result, status, xhr)

      { alert("success"); }

      ,
      error: function (xhr, status, error)

      { alert("error"); }

      }
      );
      };

      I actually thought that an open API will allow all origins but it apparently not, so I'm using jsonp because of the CORS issue.

      For some reason I'm keep getting:

      Uncaught SyntaxError: Unexpected token :
      index.js:26 Error: jQuery1113013546996610239148_1445936551798 was not called(…)

      Any idea how to solve it ?

        Activity

        fla Fernando Lopez made changes -
        Fix Version/s 2021 [ 12600 ]
        aalonsog Alvaro Alonso made changes -
        Resolution Done [ 10000 ]
        Status Answered [ 10104 ] Closed [ 6 ]
        aalonsog Alvaro Alonso made changes -
        Status In Progress [ 3 ] Answered [ 10104 ]
        aalonsog Alvaro Alonso made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        fla Fernando Lopez made changes -
        HD-Enabler KeyRock [ 10889 ]
        Description
        Created question in FIWARE Q/A platform on 27-10-2015 at 10:10
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/33364204/fiware-keyrock-sending-ajax-requests-with-access-token


        +Question:+
        Fiware KeyRock sending Ajax requests with access token

        +Description:+
        I'm building a client for a FIWARE KeyRock GE instance in Javascript.

        I have a function for querying the instance (after a successful login flow in which I received an access_token):

        keyrockManager.query = function (uri, method, params, callback) {
            if (params == null)
                params = {};
            params.access_token = keyrockManager.getAccessToken();
            $.ajax(
                {
                    url: KeyrockConfig.defaultInstanceUrl + uri,
                    type: method,
                    data: params,
                    dataType: "jsonp",
                    success: function (result, status, xhr) {
                        alert("success");
                    },
                    error: function (xhr, status, error) {
                        alert("error");
                    }
                }
            );
        };


        I actually thought that an open API will allow all origins but it apparently not, so I'm using jsonp because of the CORS issue.

        For some reason I'm keep getting:

        Uncaught SyntaxError: Unexpected token :
        index.js:26 Error: jQuery1113013546996610239148_1445936551798 was not called(…)


        Any idea how to solve it ?
        Created question in FIWARE Q/A platform on 27-10-2015 at 10:10
        {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/33364204/fiware-keyrock-sending-ajax-requests-with-access-token


        +Question:+
        Fiware KeyRock sending Ajax requests with access token

        +Description:+
        I'm building a client for a FIWARE KeyRock GE instance in Javascript.

        I have a function for querying the instance (after a successful login flow in which I received an access_token):

        keyrockManager.query = function (uri, method, params, callback) {
            if (params == null)
                params = {};
            params.access_token = keyrockManager.getAccessToken();
            $.ajax(
                {
                    url: KeyrockConfig.defaultInstanceUrl + uri,
                    type: method,
                    data: params,
                    dataType: "jsonp",
                    success: function (result, status, xhr) {
                        alert("success");
                    },
                    error: function (xhr, status, error) {
                        alert("error");
                    }
                }
            );
        };


        I actually thought that an open API will allow all origins but it apparently not, so I'm using jsonp because of the CORS issue.

        For some reason I'm keep getting:

        Uncaught SyntaxError: Unexpected token :
        index.js:26 Error: jQuery1113013546996610239148_1445936551798 was not called(…)


        Any idea how to solve it ?
        HD-Chapter Security [ 10841 ]
        fla Fernando Lopez made changes -
        Assignee Alvaro Alonso [ aalonsog ]
        backlogmanager Backlog Manager made changes -
        Field Original Value New Value
        Component/s FIWARE-TECH-HELP [ 10278 ]
        backlogmanager Backlog Manager created issue -

          People

          • Assignee:
            aalonsog Alvaro Alonso
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: