从身份验证过程开始到过程结束携带数据
我正在开发一个 Google Marketplace 应用程序。我正在使用 PHP。
我正在尝试为我的应用程序提供一个访问点,该访问点不需要用户登录我的应用程序(甚至可能是 Google Apps),然后一旦他们提交了入口点(仅包含string)该字符串通过身份验证过程进行,以便当他们验证我的应用程序可以处理该字符串,就像他们已经登录一样。
基本上我有一个 HTML 表单,就像我的应用程序的缩减版本(可以是使用 iFrame
嵌入网站例如),当用户填写它时,它会对我的应用程序中的 API 进行 AJAX 调用,这确实需要身份验证,因此身份验证过程开始,但一旦完成,它就会丢失原始数据。
有谁知道这个问题的解决方案吗?
I am developing a Google Marketplace App. I am using PHP.
I am trying to have an access point to my app which doesn't require the user to have logged into my app (or possibly even Google Apps for that matter), and then once they have submitted the entry point (which just consists of a string) that string is carried through the authentication process so that when they authenticated my app can process that string just as if they had been logged in.
Basically I have a HTML form which is like a cut down version of my app (which can be embedded on a website using an iFrame
for example), and when the user fills it out it does an AJAX call to an API in my app which does require authentication, so the authentication process begins, but once it has finished it has lost the original data.
Does anyone know a solution to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定你是否需要为此使用会话 - 可能有点矫枉过正。我不确定您的应用程序的具体细节,但您也许可以将数据放置在 $GLOBALS 超全局中。看一下文档:
php.net/manual/en/reserved.variables.globals.php
I am not sure that you need to use Sessions for this - might be overkill. I am not sure the exact specifics of your application, but you might be able to place the data in the $GLOBALS superglobal. Take a look at the documentation:
php.net/manual/en/reserved.variables.globals.php
我最终使用了会话,但它比平常更棘手,因为身份验证发生在与应用程序的访问点不同的域上。我最终所做的是对 $_SESSION 进行编码并将其存储在数据库中,然后当进行身份验证并且应用程序登录时,它会检查数据库中是否有任何会话并恢复它们。
I ended up using sessions however it was more tricky than usual because the authentication occurs on a different domain to the access point to the app. What I ended up doing was encoding $_SESSION and storing it in a database, and then when the authentication has occured and the app is logged in it checks the database for any sessions and restores them.