Meteor: loginWithGoogle without updating permission scope of user Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Meteor: loginWithGoogle without updating permission scope of user without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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.

Answer

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){})
We are here to answer your question about Meteor: loginWithGoogle without updating permission scope of user - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji