For Google OAuth for web you just need to use the Google OAuth 2.0 client ID. We store this and other config in our settings.json file something like this
"oauth": {
"google": {
"clientId": {
"web": "123456789012-abcdefghijklmnopqrstuvwxyz012345.apps.googleusercontent.com",
},
"secret": "123456abcdef789012ghijklmn",
"loginStyle": "popup",
"scope": [
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.google.com/m8/feeds",
"https://www.google.com/calendar/feeds",
"https://www.googleapis.com/auth/gmail.readonly"
]
},
and on Meteor bootup retrieve and store in database something like
import {Meteor} from 'meteor/meteor';
import {ServiceConfiguration} from 'meteor/service-configuration';
// Configure oauth
const oauthConfig = Meteor.settings.oauth;
if (! oauthConfig) {
console.warn('No Meteor.settings.oauth.');
} else {
const {oauth: {google: {clientId: {web: clientId}, ...oauthGoogle}}} = Meteor.settings;
ServiceConfiguration.configurations.upsert({service: 'google'}, {$set: {...oauthGoogle, clientId}});
}
then login looks something like this
const {scope} = ServiceConfiguration.configurations.findOne({service: 'google'});
Meteor.loginWithGoogle({requestPermissions: scope, requestOfflineToken: true}, error => {
if (error) {
// handle error
} else {
// successful login!
}
});
You don’t use a SHA1 key for web login. You just provide the authorized JavaScript origins (https://yourapp.com) and redirect URIs (https://yourapp.com/_oauth/google) as per Google documentation
For Android app the SHA1 key gets automatically built into app.
FYI, for iOS app you will need to add the “reverse client id” to your mobile-config.js
file before building something like
App.configurePlugin('cordova-plugin-googleplus', {
REVERSED_CLIENT_ID: 'com.googleusercontent.apps.123456789012-012345abcdefghijklmnopqrstuvwxyz'
});
PS You should also read the Meteor API docs for accounts