Sencha Touch 2:如何添加Google+登录? [英] Sencha Touch 2: How can I add Google+ Login?

查看:230
本文介绍了Sencha Touch 2:如何添加Google+登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 https://developers.google.com/+/web/signin/?hl=de#using_the_client-side_flow .

我已将Google脚本添加到app.json(定义为远程脚本)中,并已加载它. 我用html内容(由Google描述)创建了一个容器:

I have added the google script into the app.json (defined as remote script) and it gets loaded. I created a Container with the html stuff (described by google):

Ext.define('Bubbles.view.LoginView', {
extend: 'Ext.Container',
id: 'loginView',
config: {
    fullscreen: true,
    layout: 'fit',
    html: '<span id=\"signinButton\">'
        +   '<span class="g-signin" data-callback="signinCallback" data-clientid="CLIENT_ID" data-cookiepolicy="single_host_origin" data-requestvisibleactions="http://schemas.google.com/AddActivity" data-scope="https://www.googleapis.com/auth/plus.login"></span>'
        + '</span>',
    height: '100%',
    width: '100%',
}});

但是屏幕保持空白,没有登录按钮:-(

But the screen stays empty, no login button :-(

但是,删除上面的html部分并将其直接添加到index.html即可.不幸的是,这是一个非常糟糕的做法...

However, removing this html section above and adding it directly into index.html works. Unfortunately, this is a very bad practice...

有任何想法如何使用Sencha Touch 2正确地做到这一点?

Any ideas how to do it properly with Sencha Touch 2?

推荐答案

它可能无法正常工作,因为.g-signin元素已在Google尝试渲染按钮后添加到dom中.看一下使用JavaScript将登录按钮添加到您的页面.尤其是第四步,其中gapi.signin.render('myButton', additionalParams);用于呈现按钮.

It's probably not working because the .g-signin element is getting added to the dom after after Google tries to render the button. Take a look at adding the sign-in button to your page with JavaScript. Especially step four where gapi.signin.render('myButton', additionalParams); is used to render the button.

这篇关于Sencha Touch 2:如何添加Google+登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆