简体   繁体   English

使用Rails(和设计)对Ember App进行身份验证

[英]Authenticating Ember App with Rails (and Devise)

Referring to: Ember authentication best practices? 参考: Ember身份验证最佳做法?

We have two separate apps: a Rails backend/API and a standalone Ember app. 我们有两个独立的应用程序:一个Rails后端/ API和一个独立的Ember应用程序。 The Ember app will speak to the Rails API. Ember应用程序将使用Rails API。

I've found ember-auth ( https://github.com/heartsentwined/ember-auth ), but I don't understand why I'm going to benefit from it. 我找到了ember-auth( https://github.com/heartsentwined/ember-auth ),但是我不明白为什么我会从中受益。

Here's what I want to do : - When logging in, Ember sends username and password to my /accounts/login endpoint. 这是我想要做的:-登录时,Ember将用户名和密码发送到我的/accounts/login端点。 - If correct, Rails responds with the authentication token. -如果正确,Rails将使用身份验证令牌进行响应。 - Ember will store the authentication token locally and pass it along with each subsequent requests. -Ember将在本地存储身份验证令牌,并将其与每个后续请求一起传递。 I do not want my tokens to expire so users can always close the browser, come back, and still be logged in. 我不希望我的令牌过期,因此用户可以始终关闭浏览器,返回并仍然登录。

Is there any issues with my approach? 我的方法有什么问题吗? What about security? 那么安全性呢?

Take a look at these two Embercasts videos: 观看以下两个Embercasts视频:

Client-side Authentication Part 1 客户端身份验证第1部分
http://www.embercasts.com/episodes/client-side-authentication-part-1 http://www.embercasts.com/episodes/client-side-authentication-part-1

Client-side Authentication Part 2 客户端身份验证第2部分
http://www.embercasts.com/episodes/client-side-authentication-part-2 http://www.embercasts.com/episodes/client-side-authentication-part-2

And this blog post: 而这篇博客文章:

Authentication in ember.js ember.js中的身份验证
http://log.simplabs.com/post/53016599611/authentication-in-ember-js http://log.simplabs.com/post/53016599611/authentication-in-ember-js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM