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

Set up a new API application controller not working? #773

Closed
alexonozor opened this issue Nov 20, 2016 · 2 comments
Closed

Set up a new API application controller not working? #773

alexonozor opened this issue Nov 20, 2016 · 2 comments

Comments

@alexonozor
Copy link

alexonozor commented Nov 20, 2016

I have namespaced the route just septate it from the application controller. However the request for login and creating a new user as still using the application controller which is causing my application to break since I've active admin there. How do I explicitly tell the devise_token__auth which base controller to use.

here is the structure of my application.

app/controller/application_controller.rb - for devise and active admin

app/controller/api_controller.rb - here is the controller I want to use for the devise auth token.

route.rb


  devise_for :users

  
  namespace :api do
    scope :v1 do
      mount_devise_token_auth_for 'User', at: 'auth'
    end
  end
@lovesmall
Copy link

Hi, I'm not sure if I get your issue clearly.

If you want a user to sign in via devise token auth, he should sign in at "app/api/v1/sign_in" (via POST and maybe JSON format)

After this, all your api related requests should goes to your api related controller. I would recommend you read this https://labs.kollegorna.se/blog/2015/04/build-an-api-now/ (it's not using devise auth token for authentication, but other parts should work for your case)

Hope it works.

@zachfeldman
Copy link
Contributor

Possible answer posted by @lovesmall (thanks!) closing for now

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

No branches or pull requests

3 participants