I'm building a mobile API server for an APP. My server needs to supports users and authentication. for the last 2 days i've been searching for a good gem/ best practices of doing such task and i've failed to found.
I've seen tweaks around devise or self implementation of authentication tokens but yet to discover a full solution for such a trivial task.
http://lucatironi.github.io/tutorial/2012/10/15/ruby_rails_android_app_authentication_devise_tutorial_part_one/
https://github.com/plataformatec/devise/issues/2739
Check out the Arcadex gem https://github.com/cleor41/ArcadeX.
It's a rails engine that creates a token model. You put the gem's function inside your application controller and it grabs the token from the request headers or parameters and returns the user associated with the token or nil. Nil means the user could not be found/the token is nonexistent. The only setup is to create a token when a user is created and you want to return this token after registering or signing up and destroy it after signing out. An example use case can be found on that github. All of the functions you need for this are completed. The github will tell you where to place them.
I hope it helps out!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With