{"action":"created","issue":{"url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/155","labels_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/155/comments","events_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/155/events","html_url":"https://github.com/lynndylanhurley/devise_token_auth/issues/155","id":57906525,"number":155,"title":"is devise_invitable supported?","user":{"login":"salmanasiddiqui","id":5300463,"avatar_url":"https://avatars.githubusercontent.com/u/5300463?v=3","gravatar_id":"","url":"https://api.github.com/users/salmanasiddiqui","html_url":"https://github.com/salmanasiddiqui","followers_url":"https://api.github.com/users/salmanasiddiqui/followers","following_url":"https://api.github.com/users/salmanasiddiqui/following{/other_user}","gists_url":"https://api.github.com/users/salmanasiddiqui/gists{/gist_id}","starred_url":"https://api.github.com/users/salmanasiddiqui/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salmanasiddiqui/subscriptions","organizations_url":"https://api.github.com/users/salmanasiddiqui/orgs","repos_url":"https://api.github.com/users/salmanasiddiqui/repos","events_url":"https://api.github.com/users/salmanasiddiqui/events{/privacy}","received_events_url":"https://api.github.com/users/salmanasiddiqui/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-02-17T10:22:38Z","updated_at":"2015-08-28T18:50:29Z","closed_at":null,"body":"I am trying to use devise_invitable(1.4.0) gem with devise_token_auth(0.1.31)/devise(3.4.1) but having an issue. When I make a post request to auth/invitation the following error occurs\r\n\r\n````\r\nArgumentError in Devise::InvitationsController#create\r\nwrong number of arguments (1 for 0)\r\n\r\nExtracted source (around line #102):\r\n101        class_eval <<-METHODS, __FILE__, __LINE__ + 1\r\n102          def authenticate_#{mapping}!\r\n103            unless current_#{mapping}\r\n104              return render json: {\r\n105                errors: [\"Authorized users only.\"]\r\n\r\nTrace:\r\ndevise_token_auth (0.1.31) lib/devise_token_auth/controllers/helpers.rb:102:in `authenticate_user!'\r\ndevise_invitable (1.4.0) lib/devise_invitable/controllers/helpers.rb:18:in `authenticate_inviter!'\r\ndevise_invitable (1.4.0) app/controllers/devise/invitations_controller.rb:69:in `current_inviter'\r\ndevise_invitable (1.4.0) app/controllers/devise/invitations_controller.rb:73:in `has_invitations_left?'\r\n````\r\n\r\nFirst I setup devise_token_auth and is working perfectly. Now I am adding devise_invitable as follows:\r\n1) Passed parameter `:invitable` in user model `devise` method\r\n2) Executed migraton to add devise_invitable columns\r\n\r\nthat's it, running `rake routes` shows me that devise_token_auth is creating routes for invitation. But they are showing me above posted error.\r\n\r\nIs devise_invitable is supported by devise_token_auth? Is there a way to use them together?"},"comment":{"url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/comments/135858968","html_url":"https://github.com/lynndylanhurley/devise_token_auth/issues/155#issuecomment-135858968","issue_url":"https://api.github.com/repos/lynndylanhurley/devise_token_auth/issues/155","id":135858968,"user":{"login":"gabrielhilal","id":1133448,"avatar_url":"https://avatars.githubusercontent.com/u/1133448?v=3","gravatar_id":"","url":"https://api.github.com/users/gabrielhilal","html_url":"https://github.com/gabrielhilal","followers_url":"https://api.github.com/users/gabrielhilal/followers","following_url":"https://api.github.com/users/gabrielhilal/following{/other_user}","gists_url":"https://api.github.com/users/gabrielhilal/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrielhilal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrielhilal/subscriptions","organizations_url":"https://api.github.com/users/gabrielhilal/orgs","repos_url":"https://api.github.com/users/gabrielhilal/repos","events_url":"https://api.github.com/users/gabrielhilal/events{/privacy}","received_events_url":"https://api.github.com/users/gabrielhilal/received_events","type":"User","site_admin":false},"created_at":"2015-08-28T18:50:29Z","updated_at":"2015-08-28T18:50:29Z","body":"Hi @fertingoff, after the update action you should be able to sign in... \r\nMake sure you have the following fields in the users table:\r\n```\r\n## Invitable\r\nt.string   :invitation_token\r\nt.datetime :invitation_created_at\r\nt.datetime :invitation_sent_at\r\nt.datetime :invitation_accepted_at\r\nt.integer  :invitation_limit\r\nt.integer  :invited_by_id\r\nt.string   :invited_by_type\r\n```\r\nAlso, make sure the `invitation_accepted_at` is updated as well (after the update action).\r\n\r\nAnd just one more thing, make sure you are using the `raw_invitation_token` in the email view:\r\n\r\n`<p><%= link_to 'Accept invitation', accept_api_v1_user_invitation_url(invitation_token: @resource.raw_invitation_token) %></p>`\r\n\r\nI hope it helps ;)"}}