谷歌加登录在复选框 [英] google plus sign-in in checkbox
问题描述
我在API中实现了Google加号,我所遵循的是这个(在服务器端访问):
https://developers.google.com/+/web/signin/server-side-flow
在步骤4中,它会按照这种方式添加按钮:
< div id =signinButton>
< span class =g-signin
data-scope =https://www.googleapis.com/auth/plus.login
data-clientid =YOUR_CLIENT_ID
data-redirecturi =postmessage
data-accesstype =offline
data-cookiepolicy =single_host_origin
data-callback =signInCallback>
< / span>
< / div>
我已经完成了所有步骤,甚至可以在python方面做到。
我遇到的问题是当我试图将其更改为输入类型时:复选框
,它具有类似切换按钮的类。
我想要的是当上面的代码上的切换按钮可用时,或者显示Google + plus登录弹出窗口。但它没有。
下面是我试过的代码:
< label id =gConnectclass =switchstyle =margin-left:30px; margin-top:6px;>
< input type =checkboxid =link-switchclass =input-switch g-signindata-scope =https://www.googleapis.com/auth/plus.login
data-requestvisibleactions =http://schemas.google.com/AddActivity
data-clientid =CLIENT_ID
data-accesstype =offline
data-cookiepolicy =single_host_origin
data-callback =onSignInCallback>
< span class =switch-labeldata-on =Yesdata-off =No>< / span>
< span class =switch-handle>< / span>
< / label>
我缺少什么?
该按钮需要在块元素上进行渲染。在我的情况下,我会做的是使用gapi.auth.signIn来触发登录过程,一旦有人点击复选框。
https:// developers.google.com/+/web/signin/javascript-flow
有一个缺点是与弹出窗口阻止程序一起工作可能会非常棘手有时。如果是这种情况,那么我会做的是选择复选框带上一个灯箱或类似的登录按钮,就像你之前渲染的那样。
I am implementing the google plus sign in my API, the one I am following is this(which accesses in the server-side):
https://developers.google.com/+/web/signin/server-side-flow
At step 4 it adds the button this way:
<div id="signinButton">
<span class="g-signin"
data-scope="https://www.googleapis.com/auth/plus.login"
data-clientid="YOUR_CLIENT_ID"
data-redirecturi="postmessage"
data-accesstype="offline"
data-cookiepolicy="single_host_origin"
data-callback="signInCallback">
</span>
</div>
I have done all the steps, and was able to do it even in the python side.
The one I am having problem with is when I am trying to change it into a input type:checkbox
that has a class like a toggle button.
What I wanted is when the toggle button is on the above code will work, or the google+ plus login pop-up will show. But it doesnt.
Here is the code I tried doing:
<label id="gConnect" class="switch" style="margin-left:30px; margin-top:6px;">
<input type="checkbox" id="link-switch" class="input-switch g-signin" data-scope="https://www.googleapis.com/auth/plus.login"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-clientid="CLIENT_ID"
data-accesstype="offline"
data-cookiepolicy="single_host_origin"
data-callback="onSignInCallback" >
<span class="switch-label" data-on="Yes" data-off="No"></span>
<span class="switch-handle"></span>
</label>
Am I missing something?
The button needs to render on a block element really. What I would do in your case is use gapi.auth.signIn to trigger the sign in process once somebody clicks on the checkbox.
https://developers.google.com/+/web/signin/javascript-flow
The one downside with that is it can be tricky to work with pop up blockers at times. If that's the the case then what I would do is have selecting the checkbox bring up a lightbox or similar with the sign in button in it rendered as you had before.
这篇关于谷歌加登录在复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!