node restify oauth2 CORS - ' No' Access-Control-Allow-Origin'标头出现在请求的资源上

时间:2014-08-17 17:57:13

标签: node.js angularjs restify

在我的学习应用程序中,我使用https://github.com/domenic/restify-oauth2库来实现OAuth2。这是server.js文件中的代码片段。我已将/ token端点修改为/ api / v1 / user / login'。

server.use(restify.CORS());
server.use(restify.fullResponse());
server.use(restify.authorizationParser());
server.use(restify.bodyParser({ mapParams: false }));
restifyOAuth2.ropc(server, { tokenEndpoint: "/api/v1/user/login", hooks: hooks });

从angular.js调用此API时显示

XMLHttpRequest cannot load http://localhost:8090/api/v1/login. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.

请帮帮我

0 个答案:

没有答案