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

Is it possible to authenticate_user! without failing the filter chain? #353

Closed
ronshoshani opened this issue Aug 22, 2015 · 3 comments
Closed

Comments

@ronshoshani
Copy link

I have an API that needs to return results based on whether there is a signed in user or not.

In my controller, I would like to do something like the following:

  • Try to authenticate_user, but don't fail the filter chain if authentication failed
  • Use current_user when creating the response payload (current_user will either contain nil or the authenticated user)

Is this possible?

@booleanbetrayal
Copy link
Collaborator

Why not just have the client handle the 401 unauthorized code appropriately?
On Aug 22, 2015 6:17 AM, "Ron Shoshani" notifications@github.com wrote:

I have an API that needs to return results based on whether there is a
signed in user or not.

In my controller, I would like to do something like the following:

  • Try to authenticate_user, but don't fail the filter chain if
    authentication failed
  • Use current_user when creating the response payload (current_user
    will either contain nil or the authenticated user)

Is this possible?


Reply to this email directly or view it on GitHub
#353.

@ronshoshani
Copy link
Author

@booleanbetrayal How will this answer the above requirement?
I'm looking to not fail the request, and always return a response. The response will change a little based on whether there is a current_user or not.

@zachfeldman
Copy link
Contributor

Hi there @ronshoshani ,

In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!

If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.

Hope all is well.

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

3 participants