CoreBOSBB
coreBOS Webservice Library for AngularJS : sample code - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Development (https://discussions.corebos.org/forumdisplay.php?fid=18)
+--- Forum: coreBOS Development (https://discussions.corebos.org/forumdisplay.php?fid=4)
+---- Forum: coreBOS (https://discussions.corebos.org/forumdisplay.php?fid=5)
+---- Thread: coreBOS Webservice Library for AngularJS : sample code (/showthread.php?tid=179)



coreBOS Webservice Library for AngularJS : sample code - saidmsl - 09-04-2015

Hi,

does anyone have a test code of how the library works

the github page have only the login page.

rgds


RE: coreBOS Webservice Library for AngularJS : sample code - joebordes - 09-04-2015

Have you seen and tried this project:

https://github.com/tsolucio/coreBOSWebserviceJS


RE: coreBOS Webservice Library for AngularJS : sample code - saidmsl - 09-04-2015

Oups. no,

Thanks


RE: coreBOS Webservice Library for AngularJS : sample code - joebordes - 09-04-2015

Keep asking :-)

We have a lot of things done for this, we have been programming down this path for some time now: really impressive


RE: coreBOS Webservice Library for AngularJS : sample code - saidmsl - 09-04-2015

i have successfully installed both corebos and the angular, i got now :

coreBOS API Keys seem to be invalid as we are receiving a Not Authorized error response
{"success":false,"error":{"code":"AUTHENTICATION_REQUIRED","message":"Given user cannot be found"}}

what i missed?

the url , login and access key are all good


RE: coreBOS Webservice Library for AngularJS : sample code - joebordes - 09-04-2015

it is most probably the CORS configuration. For javascript to securely access a webservice API you have to give access to the javascript domain in the server hosting the webservice.
This can be done at the apache/server configuration level or at the application level.

coreBOS has support for CORS by configuring the config variable CORS Domains, which should be in your config.inc.php file and editable from the Settings Configuration section.

Read a little about CORS, try adding your domain to the configuration and let us know how it goes.


RE: coreBOS Webservice Library for AngularJS : sample code - saidmsl - 09-05-2015

Exactly,

i have added this under conf.d/cors.conf :


Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header set Access-Control-Max-Age "1000"
Header set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

# Added a rewrite to respond with a 200 SUCCESS on every OPTIONS request
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]


RE: coreBOS Webservice Library for AngularJS : sample code - saidmsl - 09-07-2015

Hi,
i did not see that in config.inc.php there is the cors domains configuration :

// List of CORS Authorized Domains for Webservices
$cors_enabled_domains = '*';

rgds


RE: coreBOS Webservice Library for AngularJS : sample code - joebordes - 09-08-2015

Both solutions should work correctly. Native coreBOS support is good for those people who don't have access/knowledge to modify their web server configuration, but in the end it is the same.