You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting an authentication error when I try to call my rails api (through ngResource) when I am signed in on the angular side. In my rails api controller, I have:
before_action :authenticate_user!
which is supposed to require the user to be signed in. I do believe that I am signed in on the angular side. because $auth.validateUser() is returning the user, which I can see on $scope.user. My angular controller code is:
Just fixed it :) I think, somehow, it wasn't adding the right variables from the cookie into the header, possibly because my apiUrl was defined as localhost:3000.
I'm getting an authentication error when I try to call my rails api (through ngResource) when I am signed in on the angular side. In my rails api controller, I have:
before_action :authenticate_user!
which is supposed to require the user to be signed in. I do believe that I am signed in on the angular side. because
$auth.validateUser()
is returning the user, which I can see on$scope.user
. My angular controller code is:The authentication error is happening on
Room.query
(where Room is defined via ngResource). I get the following response:errors: ["Authorized users only."]
In case it helps, I tried turning off the authentication filter and checking the value of current_user. It is nil.
Also, below are the headers sent (retrieved from Chrome console):
The text was updated successfully, but these errors were encountered: