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
app.controller('BanksIndexCtrl', function($scope, $resource, $q, bankService) {
// this will raise Unauthorized exception
$q.all([$scope.BankService.all().$promise]).then(function(ret){
$scope.banks = ret[0]
});
});
Exception on console
Started GET "/api/v1/banks" for 127.0.0.1 at 2016-04-22 22:51:47 +0800
Processing by Api::V1::BanksController#index as JSON
Filter chain halted as :authenticate_api_v1_user! rendered or redirected
Completed 401 Unauthorized in 1ms (Views: 0.1ms | ActiveRecord: 0.0ms)
Request Header
GET /api/v1/banks HTTP/1.1
Host: localhost:3000
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, */*
If-Modified-Since: Mon, 26 Jul 1997 05:00:00 GMT
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Referer: http://localhost:3000/ngAdmin/admin.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: _session_id=2971e86420fb63b7a0d1de5c2fe97d88; remember_user_token=W1sxXSwiJDJhJDEwJE4xcWhrNVMvME51Um5GeGV5anc3UWUiLCIxNDYxMzM0NDMzLjk4ODQzODEiXQ%3D%3D--bcb30c131693a6ebdd638c835f7acdc4202abb66; _ga=GA1.1.381527585.1455597511; _AlphaLoan_session=UitEN3l5WHNKdFpnV0dVWXYyUlRnYTlmdW9pUE9Oa0wydFFMWUw4c3E1Um5zaytsMmdZcy8wb01PbU9WOVA3dm9mRjUzLzRKdmQ1cmw0WDhsY0lPc3RGVTA3YUdSYm5sVXN6Rmpnd25EaU4rWTE3ZU9FakRYWHVyalJ3OTg4eGQ0RnhYWDRqMXRwazh6bmlRdk82eDM1ZzhYQk1lelRFSmVtZXc0ZTdsSGUzczJpSlhsenk0ZC9pK0k5d0wvRXpUNTNhenBsVzUwaVBONlFIOWQ5THR4MS9VS3BiQVF5NEhyVW1JNnF4N2prQXRkVGhpb2psZEZTdHNoelN2L1VzWTVBTVQ2VzlKcnE5N0I5OWVGRUlmbHFyb3NTTUZ6cHZwc2UwbW4wMWgranR4YTJHZ3V6Nm1CTVNVUTllditFMktNbDBGODNucUcydHYzT3Q1eEZyaTlnPT0tLTg4bXVLa1lFZ1NER1J6RFhGWFNyaXc9PQ%3D%3D--97b510524e0a6b970ef6ad26d87d83fadb80f51c
routes.rb
Rails.application.routes.draw do
devise_for :users , :controllers => {:registrations => "registrations"}
namespace :api do
namespace :v1, defaults: {format: 'json'} do
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
sessions: 'token_sessions'
}
...
@poc7667 Hi, were you able to solve it? Even now I see similar error in my implementation.I tried implementing for API. When I call custom controller, I see below error.
{
"errors": [
"Use POST /sign_in to sign in. GET is not supported."
]
}
In console, I see
Started GET "/v1/names" for 127.0.0.1 at 2016-10-29 21:46:57 +0530
Processing by Api::V1::NamesController#index as / Completed 401 Unauthorized in 0ms (ActiveRecord: 0.0ms)
Started GET "/auth/sign_in" for 127.0.0.1 at 2016-10-29 21:46:57 +0530
Processing by DeviseTokenAuth::SessionsController#new as /
User Load (1.0ms) SELECT users.* FROM users WHERE users.uid = 'admin@factor.in' LIMIT 1
[active_model_serializers] Rendered ActiveModel::Serializer::Null with Hash (0.0ms) Completed 405 Method Not Allowed in 124ms (Views: 122.5ms | ActiveRecord: 1.0ms)
After Signin success by email auth,
The following requests on Angular (js side) are Unauthorized.
I can not see the token in the success response,
And I guess those following requests didn't send the tokens as well.
What's the buggy point? Thanks
successful email auth on http://localhost:3000/api/v1/auth/sign_in
I do the GET request in other controllers and got Unauthorized exception
Authentication on http://localhost:3000/api/v1/banks
I got `401 (Unauthorized)``
Exception on console
Request Header
routes.rb
api/v1/banks.rb
application.rb
Angular App config
The text was updated successfully, but these errors were encountered: