PatrickJS / angular-intercom

An Angular.js wrapper for Intercom.io providing a simple and familiar API for Angular Developer.
MIT License
89 stars 36 forks source link

CORS Issue - Annyone else getting this? #30

Open Skylude opened 8 years ago

Skylude commented 8 years ago

XMLHttpRequest cannot load https://api-ping.intercom.io/vjs/users/ping. No 'Access-Control-Allow-Origin' header is present on the requested resource.

This is when using the script from inside angular instead of putting the script directly on the page.

yjwong commented 8 years ago

Seems to be ok for me. Does the issue still happen for you? The Intercom ping endpoint always returns Access-Control-Allow-Origin: *, so there's no reason why it would be broken.

Skylude commented 8 years ago

Yeah it's still happening. I'll do some more digging tomorrow. If I include the script normally in html it works but when I use async loading it throws that error. Thanks for getting back to me!

On Feb 28, 2016, at 11:02 AM, Wong Yong Jie notifications@github.com wrote:

Seems to be ok for me. Does the issue still happen for you? The Intercom ping endpoint always returns Access-Control-Allow-Origin: *, so there's no reason why it would be broken.

— Reply to this email directly or view it on GitHub.

Skylude commented 8 years ago

Just a quick update the problem was I was sending a parameter called "companies" as a javascript list instead of company. For some reason this threw a CORS error and NOT a typical 500 response. One other question I have for you is secure mode found here, https://docs.intercom.io/configuring-intercom/enable-secure-mode

Do you plan on supporting this?

Thanks again!

Date: Sun, 28 Feb 2016 10:02:49 -0800 From: notifications@github.com To: angular-intercom@noreply.github.com CC: skylercain@outlook.com Subject: Re: [angular-intercom] CORS Issue - Annyone else getting this? (#30)

Seems to be ok for me. Does the issue still happen for you? The Intercom ping endpoint always returns Access-Control-Allow-Origin: *, so there's no reason why it would be broken.

— Reply to this email directly or view it on GitHub.

yjwong commented 8 years ago

That's interesting - Secure mode is actually supported, you just have to send the user_hash as part of the user options.

$intercom.boot({
    'user_hash': ...
    ... // Rest of user properties
});

You can generate the user_hash on the server-side.