简体   繁体   English

谷歌应用程序引擎:通过javascript进入登录页面?

[英]google app engine: go to login page by javascript?

Do anyone know how do use javascript to redirect user login using Google Accounts? 有谁知道如何使用JavaScript来重定向使用Google帐户的用户登录?

I know there is " users.create_login_url(self.request.path) " but how do that integrated to "`window.location" 我知道有“ users.create_login_url(self.request.path) ”,但如何将其集成到“`window.location”

Or there is alternative?? 还是有其他选择?

You should be able to pass the string that is created by users.create_login_url(self.request.path) to your template as a template variable, and then the template variable can be inserted into your Javascript with double curly braces (if you are using the bundled Django templates): 您应该能够将users.create_login_url(self.request.path)创建的字符串作为模板变量传递到模板,然后可以使用双花括号将模板变量插入Javascript(如果使用的是捆绑的Django模板):

window.location = {{ authention_url }}

where authentication_url is the template variable that you created in your RequestHandler. 其中authentication_url是您在RequestHandler中创建的模板变量。

我的错,我什至不知道users.create_login_url(self.request.path)会生成一个字符串,只需将其打印出来即可。

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

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