question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best practice for integrating with Rails and Authentication

See original GitHub issue

Decided to take a look at Stimulus for loading a few ui pieces after initial page rendering in one of our older Rails apps. Newer apps we’ve gone with more of the single page app backed with Rails API, but this seems like a great way of using it to load smaller elements and it works well so far.

What approach do you take to deal with the authentication issue. For example, our Devise login screen shows up in the fetched HTML since we are calling :authenticate_user! in the ApplicationController. I don’t want to ignore auth on the new routes for these partials as they may contain sensitive data, but it seems like implementing a complete JWT mechanism is overkill since it wouldn’t be needed everywhere.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
javancommented, Feb 1, 2018

If you’re making fetch requests, add { credentials: 'same-origin' } to the options: https://github.com/github/fetch#sending-cookies

1reaction
sstephensoncommented, Feb 2, 2018

Closing this for now, but feel free to continue the conversation over on the new Stimulus Discourse.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cybersecurity Best Practices for Ruby on Rails Developers
How do we integrate cybersecurity best practices? Here are some processes and tips for Ruby on Rails developers.
Read more >
Building Secure APIs with Rails 6 and Auth0
Learn how to easily integrate Auth0 with Rails 6 to build secure APIs. ... Try out the most powerful authentication platform for free....
Read more >
How to Do Authentication Right With Rails Devise - Stackify
If you're just starting to use Rails Devise to authenticate your Rails apps, you might have some questions about the best ways to...
Read more >
Security Best Practices for Your Rails Application
Application Configuration · Force SSL · CORS · Secure Environment Variables · Business Logic · Strong Authentication and Authorization Rules.
Read more >
Simple Authentication with Rails and OmniAuth | Okta Developer
Today I'm going to show you how to authenticate users into your Rails applications using the latest best-practices and a hosted ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found