简体   繁体   English

如何在Wordpress网站和Rails应用程序之间共享身份验证信息?

[英]How to share authentication info between wordpress site and a rails app?

Here's what we are trying to do: 这是我们正在尝试做的事情:

  1. Application "X" is on wordpress hosted on example.com 应用程序“ X”位于example.com上的wordpress上
  2. Application "Y" is built in RoR (ruby 2, rails 4) hosted on form.example.com. 应用程序“ Y”内置在form.example.com上的RoR(红宝石2,导轨4)中。 It uses 'devise' for managing authentication. 它使用“设计”来管理身份验证。
  3. On Application "X", we need to show a login form (email, password, submit button) in a corner of the page. 在应用程序“ X”上,我们需要在页面的一角显示一个登录表单(电子邮件,密码,提交按钮)。 The form is loaded from Application "Y" and submitted back to it. 该表单是从应用程序“ Y”加载并提交回给它的。
  4. If login is successful, username is fetched from 'Y" and shown on "X". If login is unsuccessful, error message shown on "X". All this should happen without leaving example.com 如果登录成功,则从“ Y”获取用户名并显示在“ X”上;如果登录失败,则在“ X”上显示错误消息。所有这些都应发生而无需离开example.com
  5. If the user closes the window and comes back to this page later on, the session should be read from "Y" and current login status should be shown. 如果用户关闭窗口并稍后返回此页面,则应从“ Y”读取会话,并应显示当前登录状态。

Any pointers greatly appreciated. 任何指针,不胜感激。

Your question might as well be How Do I Write An API? 您的问题也可能是How Do I Write An API?

What you're asking is how to not only port data, but also functionality (authentication) between two different applications. 您要问的是如何不仅在两个不同的应用程序之间移植数据,而且还要移植功能(身份验证)。 Whilst this is entirely feasible with an API (Application Programming Interface) , the trick lies in creating the relationship between the two 尽管使用API(应用程序编程接口)完全可行,但窍门在于在两者之间建立关系

Wordpress has its own authentication system, and Devise has its own as well. Wordpress有自己的身份验证系统,而Devise也有自己的身份验证系统。 The problem is helping both of these applications "talk" to each other 问题是帮助这两个应用程序彼此“交谈”


If you'd like me to give some ideas about how to write an API for this, please let me know. 如果您希望我提供一些有关如何为此编写API的想法,请告诉我。 Otherwise, I would recommend looking what you're actually trying to achieve -- it might be right to stick to one framework or the other 否则,我建议您查看您实际想要实现的目标-坚持使用一个框架或另一个框架可能是正确的

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

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