小编典典

将Google Plus登录添加到Ionic应用

angularjs

我正在尝试将google plus登录名添加到我的ionic app。跟随此链接给我一个错误。

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

错误是: cannot read property googleplus of undefined.

这是我的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();
}
});
})

阅读 321

收藏
2020-07-04

共1个答案

小编典典

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

  1. ionic start newApp
  2. ionic platform add android
  3. cordova plugin add cordova-plugin-inappbrowser
  4. bower install ngCordova
  5. bower install ng-cordova-oauth -S
  6. 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>
  1. 依赖注入

  2. 包含以下代码

        $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);
    });
    }
  1. 添加按钮以查看文件并调用函数
2020-07-04