https://github.com/sujith3g/meteor-g-plus
Meteor google plus login example using hedcet:cordova-google-plus-native-sign-in
https://github.com/sujith3g/meteor-g-plus
android cordova-google google-login google-plus meteor
Last synced: 4 months ago
JSON representation
Meteor google plus login example using hedcet:cordova-google-plus-native-sign-in
- Host: GitHub
- URL: https://github.com/sujith3g/meteor-g-plus
- Owner: sujith3g
- Created: 2015-06-09T19:13:51.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-27T13:33:49.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T12:54:29.317Z (about 1 year ago)
- Topics: android, cordova-google, google-login, google-plus, meteor
- Language: JavaScript
- Homepage: https://atmospherejs.com/hedcet/cordova-google-plus-native-sign-in
- Size: 16.2 MB
- Stars: 9
- Watchers: 5
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cordova Google Plus native Login implemented in MeteorJS
[](https://gratipay.com/cordova-google-plus-native-sign-in/) [](https://ghit.me/repo/sujith3g/meteor-g-plus)
#### Description
This is an example Meteor Android App with native Google Plus Login using [`hedcet:cordova-google-plus-native-sign-in`](https://atmospherejs.com/hedcet/cordova-google-plus-native-sign-in) meteor package.
#### Screenshots
#### Demo
* Android [example](https://github.com/sujith3g/meteor-g-plus/tree/master/.APK).
#### Usage
1. Add Android platform to your App `meteor add-platform Android`. You can follow [this](https://github.com/meteor/meteor/wiki/Meteor-Cordova-integration) Documentation.
2. Install `hedcet:cordova-google-plus-native-sign-in` package to your App by typing `meteor add hedcet:cordova-google-plus-native-sign-in`.
3. Add `mobile-config.js` file to your App & specify an App ID like `com.example.meteor_g_plus`
```javascript
App.info({
author: 'x',
description: 'Cordova Google Plus SignIn',
email: 'x',
id: 'com.example.meteor_g_plus',
name: 'example',
website: 'https://github.com/x/x',
version: '1.0.0',
});
```
4. Now use the App ID(`com.example.meteor_g_plus`) created in step-3 as "Android package name" to setup Google Plus API for Android by following [this guide](https://developers.google.com/mobile/add?platform=Android). Once Google Sign-In is enabled Google will automatically create necessary credentials in Developer Console. There is no need to add the generated google-services.json file into your meteor project.Make sure you execute the `keytool` steps as well or authentication will fail.
5. Create oAuth credential for web-Application in the same project(in google-dev-console created in step 4) for `accounts-google` package. Use the `client ID`, `client Secret` from web-client credentials for `accounts-google` like [this](https://github.com/sujith3g/meteor-g-plus/blob/master/server/config.accounts.js#L14).
6. Now in your client side code you can use `Meteor.cordova_g_plus({cordova_g_plus: true});` as shown
##### LogIn
```javascript
if (Meteor.isCordova) { // signIn through cordova
Meteor.cordova_g_plus({
cordova_g_plus: true,
profile: ["email", "email_verified", "gender", "locale", "name", "picture"],
webClientId: 'your-web-client-id'
}, (error) => {
if (error) {
// error handling code
}
});
}
```##### Logout
```javascript
window.plugins.googleplus.logout((msg) => {
Meteor.logout((error) => {
if (error) {
// error handling code
}
});// do something useful
});
```##### Disconnect
```javascript
window.plugins.googleplus.disconnect((msg) => {// do something useful
});
```