Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var results = $.ajax({
- // The URL to process the request
- url : "https://app1pub.smappee.net/dev/v1/oauth2/token",
- type : "POST",
- data : {
- grant_type : "password",//jshint ignore:line
- username: "myuser",
- password: "secret",
- client_id: "myclient",//jshint ignore:line
- client_secret: "clientSecret"//jshint ignore:line
- },
- beforeSend: function (xhr) {
- xhr.setRequestHeader("Authorization", "Bearer $token");
- xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
- },
- dataType: "json",
- contentType: "application/x-www-form-urlencoded",
- success: function(response) {
- //console.log(response);
- console.log(response.access_token);//jshint ignore:line
- data.access_token = response.access_token;//jshint ignore:line
- //tokenGranted();
- }
- });
- return results.responseText;
- "XMLHttpRequest cannot load https://app1pub.smappee.net/dev/v1/oauth2/token. 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:9000' is therefore not allowed access."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement