Moved to https://forums.meteor.com/t/get-accesstoken-without-storing-record-of-google-or-facebook/3395


#1

I’m implementing invite people in my app, I want to use googgle contacts,

If I use accounts-google package for authenticating the user, It will be complex process, beause I don’t want to store user information,

I just want one time auth, so I’m searching for client side solutions,

var url='https://accounts.google.com/o/oauth2/auth?scope=https://www.googleapis.com/auth/contacts.readonly&client_id=5558545-3n8vg6u4nu2hm1gmuj1dbjib28p33qss.apps.googleusercontent.com&redirect_uri=http://localhost:3000/_oauth/google&response_type=token'

var newWindow = window.open(url, ‘name’, ‘height=600,width=450’);
on click of invite button I’m calling this it is working well, but how to read the accesstoken returned by this window.

I can’t find how to do this?

I tried using HTTP method

HTTP.get(url, {}, function(e,r){
console.log(e,r);
});
but it throwing error, It is not working.


#2

What error do you get?


#3


#4

You might want to check that:

  • your redirect_uri is properly registered in the Google developer console
  • any browser plugin that prevents social connection (ex: Disconnect) is disabled

#5

looks like it is a problem related to CORS


#6

I am not sure. Google is cool with CORS.
Can you please show us how you declare your redirect in the Google developer console?


#7


#8

If I do same request in server side, it is responding with status code 200, with some html content

Anybody know how to redirect the user to google auth and get the accesstoken without logging in the user into the application?