1

backend: Sails app w/ Waterlock, Waterlock-local-auth frontend: An angular app

I'm running into a issue where postman works fine, gets JWT from /user/jwt all good and dandy but whenever I login through the browser and then attempt to hit /user/jwt it gives 403 forbidden. Any clues?

I have CORs enabled for all origins on all routes.

Any help would be appriciated!

4

1 回答 1

2

为像我这样的新手节省一些时间:

$http 不会将会话数据与请求一起传递,因此 Sails/express 服务器不知道 /user/jwt 请求是从哪个“会话”发出的,因此应该给出 403。我猜邮递员会自动为您处理这个问题。

将此添加到我的角度配置中:

config(['$httpProvider', function($httpProvider) {
    $httpProvider.defaults.withCredentials = true;
}]).
于 2015-11-28T21:19:13.717 回答