top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Authentication in Ruby On Rails for both Web & API

+4 votes
416 views

I need to develop an application which needs to authenticate user by verifying login name/password for both web access and API. I need the same controller to cater to both web and API. I can put the before_filter for the controller to make sure that user is logged-in and user_id is in session. But how do I design the controller that if the request comes as a rest web service request then before filter should not check session for logged user but should authenticate with login/password passed as parameters with request and then should go ahead whichever way the request came to controller.

I would really appreciate any code samples/links to sites which explain how to do that.

posted Nov 22, 2013 by Bob Wise

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

AWS API requests do this thing where you establish a connection using the two keys (access and secret) and get a token to use for the rest of your API accesses (I’m pretty sure this times out eventually).

answer Nov 22, 2013 by Garima Jain
Similar Questions
+2 votes

Any particular point why should I go for Rails to develop my website?

+1 vote

I want to provide login feature in my application so that users can logged in using there Gmail account instead of creating user name and password.

Please suggest how to proceed?

+1 vote

Rails seems to have a whole whack of them and I'm not sure which ones match my requirements. The library must:

  • be fully themeable; the overall layout is going to be made from scratch
  • allow custom content for pages (i.e. a developer-made page)
  • allow defining of different types of posts with different fields/data
  • support image upload for at least pages and preferably posts as well
  • be relatively easy to extract post content outside the CMS (e.g. for use in sending an e-mail digest)

Preferably it should:
- Be compatible with Rails 4
- allow individual pages to be user-edited with HTML/CSS after they've been created

Can anyone recommend one for me?

...