Google Oauth Meteor Stream

In the Meteor app, can someone tell me how to allow users to just Oauth Google?

You have a google-package account, but I don’t want users to be able to log into it, just oauth and store credentials.

The docs mention "If you just want to authenticate for an Oauth service, such as Twitter, Facebook or Google, without using accounts, that is, if you do not want to register a user, you just need an OAuth token - you can use basic service packages, such like twitter, facebook and google directly. ", but there are no documents for the google package.

Any guidance would be greatly appreciated.

+5
source share
2 answers

The Oauth package is just for that. If you want to use it to get people credentials

There are two options:

1) Change the source of the google and accounts-google packages to remove the parts you enter. There are no documents for this. I'm afraid it’s better to understand that these are inline comments.

2) Use a different atmosphere package to combine google accounts with an existing login. Thus, they are already logged in, but can use Meteor.logInWithGoogle() to log in to Google, and this is combined with an existing account. This way they do not need to log in with Google, but you can store the OAuth token. For this you can use the bozhao:link-accounts package or the mikael:accounts-merge package:

 // ON THE CLIENT: Meteor.signInWithGoogle ({}, function (error, mergedUserId) { // mergedUsers is set if a merge occured if (mergedUserId) { console.log(mergedUserId, 'merged with', Meteor.userId()); } }); 

You will then find the google OAuth token data in services.google in the existing Meteor.user() document.

+1
source

It’s pretty easy to handle Google OAuth manually. Check out my answer to this (similar) SO question

Getting OAuth Tokens Without User Registration

0
source

All Articles