My Meteor application lets user register and login with Google and by email/password.
When logging in with Google, I am only requesting for email
permission. After logging in, the user can go to user settings and Connect Google Calendar
, which will add the calendar permission to the user's scope (By executing another loginWithGoogle
requesting calendar permission this time).
The problem is, every time a user logs in with Google account from the login page, the scope
object is updated by loginWithGoogle
function and the calendar scope is removed (because here the login function only requests for email permission).
Is there any way of logging in the user without updating/replacing the scope? I can not ask for calendar permission from Log In page because I want the users to be able to decide weather or not they want to sync their calendar with the app.
Thanks.
If anyone else is looking for the answer, the solution was as easy was adding an option include_granted_scopes:true
to the login options.
i.e.
Meteor.loginWithGoogle({
requestPermission: ['email'],
loginUrlParameters: {include_granted_scopes: true}
}, function(err){})