添加google plus登录到离子应用程序 [英] Adding google plus login to ionic app

查看:184
本文介绍了添加google plus登录到离子应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将google plus登录添加到我的离子应用
点击此链接给我一个错误。

I am trying to add google plus login to my ionic app. Following this link gives me an error.

https://ionicthemes.com/tutorials/about/google-plus-login-with-ionic-framework

错误是:无法读取未定义的googleplus属性。

这是我的 app.js

.run(function($ionicPlatform) {
   $ionicPlatform.ready(function() {

    if (window.cordova && window.cordova.plugins.Keyboard) {
    cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
  cordova.plugins.Keyboard.disableScroll(true);

}
if (window.StatusBar) {
  // org.apache.cordova.statusbar required
  StatusBar.styleDefault();
}
});
})


推荐答案

在Device中配置身份验证的步骤(android)

Steps to Configure authentication in Device(android)


  1. 离子st art newApp

  2. ionic platform add android

  3. cordova插件添加cordova-plugin-inappbrowser

  4. bower安装ngCordova

  5. bower安装ng-cordova-oauth -S

  6. 将两个脚本都包含在<$ c中$ c> index.html 以上 cordova.js

<script src="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script>
<script src="cordova.js"></script>


  • 依赖注入

  • Dependency injection

    包括以下代码

    $scope.googleLogin = function() {
    console.log('In My Method');
    $cordovaOauth.google("Client ID", ["https://www.googleapis.com/auth/urlshortener", "https://www.googleapis.com/auth/userinfo.email"]).then(function(result) {
        console.log(JSON.stringify(result));
        // results
    }, function(error) {
        // error
        console.log('In Error');
        console.log(error);
    });
    }
    


  • 添加按钮查看文件并调用函数

  • add button to view file and call the function

    这篇关于添加google plus登录到离子应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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