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

Namespacing for API? #146

Closed
foffer opened this issue Jan 13, 2015 · 1 comment
Closed

Namespacing for API? #146

foffer opened this issue Jan 13, 2015 · 1 comment

Comments

@foffer
Copy link

foffer commented Jan 13, 2015

Hi Gonzalo. How do you go around namespacing for an API with this gem? I can't figure out whether it's STA or Devise who's causing the trouble, but when trying to do the following my app and auth specs break.

constrants subdomain: 'api' do
  namespace :api, path '/' do
    namespace :v1 do
      devise_for :users, :skip => [:sessions, :registrations, :passwords], path_prefix: 'api/v1'
      devise_scope :user do
          post 'login' => 'sessions#create', :as => :login
          delete 'logout' => 'sessions#destroy', :as => :logout
          post 'register' => 'registrations#create', :as => :register
          delete 'delete_account' => 'registrations#destroy', :as => :delete_account
      end
    end
  end
end

That's with the subdomain configured in the hosts file and the following test:

It 'creates a new user with correct credentials' do
            post 'http://api.scrapit-dev.com:3000/v1/register', format: :json, :user => {email: 'user@test.com', password: 'TestPass123', password_confirmation: 'TestPass123', username: 'testuser'}
end

This is the error I get
screen shot 2015-01-13 at 12 47 51

@gonzalo-bulnes
Copy link
Owner

Hi @foffer, I forgot answering your question, I'm sorry for that. The namespaces issues related to Simple Token Authentication were described in #83, and should be solved by the possibility to define aliases for namespaced models that the v1.9.0 release does ship.

Another namespace-related, but not directly Simple Token Authentication-related issue was mentionned in this comment but I sadly don't know what happened with it.

That's it, I hope you found your way through it.

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