我目前正在开发一个基于 python 的应用程序引擎网站,并希望添加 Google 身份工具包功能,但在实现密码重置和更改电子邮件地址方面遇到了困难。
已经能够让 python 快速入门示例 ( https://developers.google.com/identity/toolkit/web/quickstart/python ) 正常工作,但即使使用它,我也无法正确设置密码重置和电子邮件更改组件
我一直在浏览谷歌群组https://groups.google.com/forum/#!forum/google-identity-toolkit但似乎无法找到基于 python 的详细步骤或示例代码
有人有任何想法或可以指出我正确的方向吗?非常感谢!
最佳答案
经过一些尝试和错误,我已经能够通过以下方式使其工作:
- 使用 gitkit 服务器配置 json 创建 gitkit 实例
- 调用 GetOobResult 函数,该函数会发回一个包含重置链接和其他信息的字典(这是关键)
- 最后,为了让用户通知正常工作,您需要返回带有 {'success' : true} 的 json 转储
这是我使用的关键代码行——应该注意,这不包括带有密码重置链接的电子邮件发送部分,您必须与 gitkit 分开实现。
server_config_json = os.path.join(os.path.dirname(__file__), 'gitkit-server-config.json')
gitkit_instance = gitkitclient.GitkitClient.FromConfigFile(server_config_json)
output = gitkit_instance.GetOobResult(self.request.POST,self.request.remote_addr)
if output:
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(json.dumps({'success': True} ))
关于python - 在 Google Identity Toolkit 中实现重置密码和电子邮件更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32885577/