[ https://jira.fiware.org/browse/HELP-8769?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fernando Lopez updated HELP-8769:
---------------------------------
HD-Chapter: Security
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 ?
was:
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-Enabler: KeyRock
> [fiware-stackoverflow] Fiware KeyRock sending Ajax requests with access token
> -----------------------------------------------------------------------------
>
> Key: HELP-8769
> URL: https://jira.fiware.org/browse/HELP-8769
> Project: Help-Desk
> Issue Type: Monitor
> Components: FIWARE-TECH-HELP
> Reporter: Backlog Manager
> Assignee: Alvaro Alonso
> Labels: ajax, fiware, javascript, jquery
>
> 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 ?
--
This message was sent by Atlassian JIRA
(v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy