Magento API REST 客户未重定向到身份验证页面 [英] Magento API REST customer not redirecting to Authentication Page
问题描述
我正在尝试通过客户帐户访问产品.为了实现这一点,我使用了 oauth_customer.php magento 文档页面中的示例代码.一切正常,工作正常;但我面临的问题是,每当我在成功登录页面后以客户身份登录时,都会重定向到客户仪表板,而不是重定向到身份验证 URL.
为此,我必须再次手动通过 URL 链接,因此它会重定向到身份验证页面,身份验证后,它会显示我想要的任何内容.
我还尝试从链接中的示例代码扩展帐户控制器:https://docs.google.com/file/d/0BzCDl5a0zmSVdWdFMG9jMTB1TXM/edit?pli=1
但仍然没有运气.有没有像我们在管理员身份验证端那样登录后再次创建回调 URL?
I am trying to access products through Customer account. To achieve this I am using sample code from oauth_customer.php magento documentation page.
Everything is okay and working fine; but the thing I am facing is that whenever I login as customer after successful login page redirects to the Customer Dashboard instead of redirecting to the Authentication URL.
To do so I have to past the URL link again manually, so it redirects to the Authentication page and after authentication it shows whatever I want.
I have also tried to extend the account controller from a sample code from link:
https://docs.google.com/file/d/0BzCDl5a0zmSVdWdFMG9jMTB1TXM/edit?pli=1
But still there is no luck. Is there anyway to make a callback URL again after login like we do in admin authentication side?
推荐答案
使用 Oauth 时,oauth 消费者登录表单重定向到 customer/account/loginPost.
When using Oauth, the oauth consumer login form redirects to customer/account/loginPost.
由于缺少参数 formkey,loginPost 函数会将您重定向到 customer/account/login.
The loginPost function redirects you to customer/account/login because the parameter formkey is missing.
只需在 app/design/frontend/package/theme/template/oauth/authorize/form/login.phtml 的表单标签末尾添加:
Just add this in app/design/frontend/package/theme/template/oauth/authorize/form/login.phtml at the end of the form tag:
<input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
添加此重定向后,重定向将正常工作.在 Magento CE 1.9.0.0、EE 1.14.1.x 中测试
Redirect will work fine when you add this. Tested in Magento CE 1.9.0.0, EE 1.14.1.x
这篇关于Magento API REST 客户未重定向到身份验证页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!