1

I am building a Campfire client that will run in WebOS and as a Chrome desktop web app. I have the following code:

logIn: function(){
    this.apiToken = this.$.loginScreen.$.apiToken.getValue();
    this.subdomain = this.$.loginScreen.$.subdomain.getValue();
    this.fullURL = 'https://' + this.subdomain + '.campfirenow.com/';
    this.$.roomService.url = this.fullURL + 'rooms.json';
    var response = this.$.roomService.send({'Authorization': "Bearer " + this.apiToken, 'Access-Control-Allow-Origin': this.subdomain + '.campfirenow.com'});

The 'roomService' is like this:

{name: "roomService", kind: "enyo.WebService", url: null, onResponse: "successfulAlert", onError: "someFailure"}

And in Chromium I keep getting the following XMLHttpRequest error:

Origin null is not allowed by Access-Control-Allow-Origin.

Any ideas?

Sam Mussmann
  • 5,883
  • 2
  • 29
  • 43
RedMage
  • 1,126
  • 1
  • 9
  • 21

1 Answers1

2

You might want to take a look at this StackOverflow question:

XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin

You're being blocked by trying to run this from a file:// URL.

Community
  • 1
  • 1
Pre101
  • 2,370
  • 16
  • 23
  • and to add, if you were running it from a server, you may still be blocked if Campfire didn't allow cross-site access to their APIs over AJAX *OR* the user's browser doesn't support cross-site AJAX semantics. – Ben Combee Jul 17 '12 at 19:27
  • I am running from Chromium with the security features disabled. Maybe I can embed a node.js server into my app and make calls that way? I'd much rather just use the webservice somehow. – RedMage Jul 24 '12 at 22:38