Closed drouillard closed 8 years ago
Your passport.js
should look like this:
_.merge(exports, {
passport: {
google: {
options: {
clientID: '...',
clientSecret: '...'
}
}
}
});
Thanks. I will give that a shot
Ended up not using Sails Auth at all.
https://developers.google.com/identity/sign-in/ios/backend-auth
https://github.com/google/google-api-nodejs-client/
Get the access_token from the Google iOS native sign-in process and then pass to back-end. Once you get the token then can verify with Google
var google = require('googleapis');
var plus = google.plus('v1');
var OAuth2 = google.auth.OAuth2;
var oauth2Client = new OAuth2(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);
// Retrieve tokens via token exchange explained above or set them:
oauth2Client.setCredentials({
access_token: 'ACCESS TOKEN HERE',
refresh_token: 'REFRESH TOKEN HERE'
});
plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, response) {
// handle err and response
});
New to Sails, spent many hours trying to get Google Sign-in via Passport. Here are issues I have encountered
It seems like I have to overwrite the google credentials in /node_modules/sails-auth/config/passport.js rather than my own config/passport.js. I am sure this is incorrect, but could not get it work by copying / pasting what was in the node module passport.js into my own. How do I make this work with my own config/passport.js? Currently trying
I had to manually install the passport-google-oauth package. But yet it seems like it should be it is already included as a dependency. I am using NVM. Encountered this with lodash as well. Does this seem right?