Steps to Configure authentication in Device(android)
ionic start newApp
ionic platform add android
cordova plugin add cordova-plugin-inappbrowser
bower install ngCordova
bower install ng-cordova-oauth -S
-
include both script into
index.html
abovecordova.js
<script src="https://stackoverflow.com/questions/37523038/lib/ngCordova/dist/ng-cordova.min.js"></script> <script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script> <script src="https://stackoverflow.com/questions/37523038/cordova.js"></script>
-
Dependency injection
-
include below code
$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