Use Google api without logging out the current user


#1

Im using accounts-password package and I don’t want to use any other services for login.

But in my app I have a requirement to use google api.

So how can I use Google api without logging out the current user, I need to request offline token too, Is there any way to do this?
I want to keep the login info in my db, it is just like login with google but I don’t want to logout the user logged in with password just like accounts-merge packages,but they’ll login the user which is not my requirement
Can somebody explain the flow how can I do this?

Any recommended packages?

Thx


#2

If I understand your requirement correctly, you’ll need to talk directly to the API with Meteor’s HTTP calls.

You could also take a look at https://atmospherejs.com/centiq/crest - a lightweight wrapper package for accessing generic REST endpoints (disclosure: I work for Centiq).


#3

This is how I do on CodersTV:

To request offline token, it’s a configuration: http://docs.meteor.com/#/full/meteor_loginwithexternalservice
{requestOfflineToken: true}


#4

What you can do is add accounts-google to your project and use one of (I’m sure there are a couple others similar)

To link your users’ google accounts to their local accounts.

And just like @gabrielhpugliese explained, use requestOfflineToken: true so that you don’t need them online while you are making API calls.