particle-iot / spark-server

UNMAINTAINED - An API compatible open source server for interacting with devices speaking the spark-protocol
https://www.particle.io/
GNU Affero General Public License v3.0
441 stars 136 forks source link

getting auth_token over curl failed #19

Closed kennethlimcp closed 8 years ago

kennethlimcp commented 10 years ago

This is the curl command:

curl http://208.xx.xxx.xxxx:8080/v1/access_tokens -u kennethlimcp@lc.com:xxxxx

This is the output:

TypeError: Object function (options) {
    this.options = options;
} has no method 'basicAuth'
    at Object.AccessTokenViews.index (/Users/administrator/spark-server/js/lib/AccessTokenViews.js:37:44)
    at callbacks (/Users/administrator/spark-server/js/node_modules/express/lib/router/index.js:164:37)
    at param (/Users/administrator/spark-server/js/node_modules/express/lib/router/index.js:138:11)
    at pass (/Users/administrator/spark-server/js/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/Users/administrator/spark-server/js/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/Users/administrator/spark-server/js/node_modules/express/lib/router/index.js:33:10)
    at next (/Users/administrator/spark-server/js/node_modules/express/node_modules/connect/lib/proto.js:193:15)
    at next (/Users/administrator/spark-server/js/node_modules/express/node_modules/connect/lib/proto.js:195:9)
    at Object.handle (/Users/administrator/spark-server/js/node_modules/node-oauth2-server/lib/oauth2server.js:104:11)
    at next (/Users/administrator/spark-server/js/node_modules/express/node_modules/connect/lib/proto.js:193:15)

Works ok with spark-cli with spark subscribe but not via CURL

kennethlimcp commented 10 years ago

Further digging reveals that spark-server is not able to handle the OAuth authentication using the curl authorization bearer with auth token.

Doing a direct curl command works OK:

curl "http://website.com:8080/v1/events?access_token=6838897939bee04c2c445a82a7a3c8cb526adc5b"
goodkiller commented 9 years ago

Same problem here, when this will be fixed?

dmiddlecamp commented 9 years ago

I'll set aside some development time this next sprint to address some old issues in the local server, so hopefully in the next 2 weeks.