rest-api
rest-api copied to clipboard
Cross-Origin Request Blocked
headers.append('Authorization', btoa('[email protected],key'));
headers.append('Access-Control-Allow-Origin', 'https://{{domain}}.agilecrm.com');
headers.append('Access-Control-Allow-Methods', 'POST');
headers.append('Access-Control-Max-Age', '86400');
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://aliworkspace.agilecrm.com/dev/api/contacts. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
I am facing the same issue, is there a solution to this one?
headers.append('Authorization', btoa('[email protected],key')); headers.append('Access-Control-Allow-Origin', 'https://{{domain}}.agilecrm.com'); headers.append('Access-Control-Allow-Methods', 'POST'); headers.append('Access-Control-Max-Age', '86400');
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://aliworkspace.agilecrm.com/dev/api/contacts. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Facing the same issue
I didn't use the rest-api library, agile have nodejs library you can use that https://github.com/agilecrm/nodejs
I want to implement this on front end react app. Is there a way to do it on react app?
Please use Agile CRM JS api which takes care of CORS issue.
On Mon, Oct 21, 2019 at 10:54 AM sahil912 [email protected] wrote:
I want to implement this on front end react app. Is there a way to do it on react app?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/agilecrm/rest-api/issues/51?email_source=notifications&email_token=AARBBLIL3ZRCF4AJQNGOQDLQPU4H3A5CNFSM4EOZAD2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBZC3GA#issuecomment-544353688, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARBBLNWJK27U2SNCBLJPCDQPU4H3ANCNFSM4EOZAD2A .
Please use Agile CRM JS api which takes care of CORS issue. … On Mon, Oct 21, 2019 at 10:54 AM sahil912 @.***> wrote: I want to implement this on front end react app. Is there a way to do it on react app? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#51?email_source=notifications&email_token=AARBBLIL3ZRCF4AJQNGOQDLQPU4H3A5CNFSM4EOZAD2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBZC3GA#issuecomment-544353688>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARBBLNWJK27U2SNCBLJPCDQPU4H3ANCNFSM4EOZAD2A .
Tried to use the JS API to create contact contact is the json object
axios.post("https://{domain}.agilecrm.com/dev/api/contacts", contact, {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
auth: {
username: 'email',
password: 'api_key'
}
}).then(response => {
}).catch(error => {
});
Getting the following 401 error, attaching the screenshot:
@sahil912 you need to add your host to allowed domains in agilecrm admin settings
I'm facing the same issue while using the NodeJS library. @seleckis Where exactly can one do that? Can you share a screenshot. Did you mean Admin Settings -> Preferences -> Security (to add IPs). FYI: I have a free account if that matters
@andyfaizan Admin Settings -> Analytics -> Allowed Domains
Still doesn't work unfortunately. I can cURL the API and it works since the cURL sends a direct POST request whereas the browser sends an OPTIONS request first and it goes through the auth and gets a 401. OPTIONS should always be allowed on the server side.
any updates?