Google app script web app, how to create a login button?

余生长醉 提交于 2019-12-04 17:15:32

Created sample code for 2 .gs web app projects: one - no auth, runs as owner, anonymous can access two - needs auth, runs as user, anyone can access

...as I have no idea what your "I got it to work redirecting the user to the URL" statement looks like in code.

The 1st file has a button with a click listener to act as the login button, but it's just calling for a window.top.location.href change. The 2nd app is using ScriptApp.invalidateAuth(); to log users out after being called from a client-side button click.

Demo - 1st web app url

I'd still vote to just offer a 2nd web app as a link that pops open in a new window though and as I note in the comment, the setup above forces users to re-authorize each time and after the signout.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!