Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access to current_user not available #1246

Closed
pranavbhalla opened this issue Dec 29, 2018 · 1 comment
Closed

access to current_user not available #1246

pranavbhalla opened this issue Dec 29, 2018 · 1 comment

Comments

@pranavbhalla
Copy link

Hi,

Please let me know how to access current_staff (my Devise model is called 'Staff' instead of User) after logging in -

I am sending request like this - curl -XGET -v -H 'Content-Type: application/json' http://localhost:3000/api/v1/calls/

But getting an error - NameError (uninitialized constant Api::V1::CallsController::AuthorizationException):

app/controllers/api/v1/calls_controller.rb:348:in `authenticate_staff!'

Do we need to send access token in the curl request every time ?

My calls_controller inherits the application controller
class Api::V1::CallsController < Api::V1::ApplicationController

and my application controller -
class Api::V1::ApplicationController < ActionController::API #Note: here is not ::BASE
include DeviseTokenAuth::Concerns::SetUserByToken

@MaicolBen
Copy link
Collaborator

MaicolBen commented Jan 13, 2019

hey @pranavbhalla !
did you look at the issues https://github.com/lynndylanhurley/devise_token_auth/issues?q=is%3Aissue+current_user+is%3Aclosed ? this is the most asked issues and it's common a missing configuration

Do we need to send access token in the curl request every time ?

Yes, otherwise how we determine which user is using the app? If you need more info, you can check https://devise-token-auth.gitbook.io/devise-token-auth/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants