- 浏览: 2487044 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Hybrid(5)Customize Meteor Directly Google Login
1. First of All, Find a working Release on Meteor
Currently, the release version release-1.2 is working, so I branch from that release and create release-1.2.1 on my own fork.
https://github.com/luohuazju/meteor/tree/release-1.2.1.
The only changes I made there is to support the google hint email.
https://github.com/luohuazju/meteor/commit/0897eab2bfc71036a12b6550df76e2a8ff30f19f
var loginUrl = 'https://accounts.google.com/o/oauth2/auth?' +
_.map(loginUrlParameters, function(value, param){
return encodeURIComponent(param) + '=' + encodeURIComponent(value);
}).join("&");
if (options.loginHint) {
loginUrl += '&login_hint=' + encodeURIComponent(options.loginHint);
}
2. Make The Google Login working in Meteor
All the details are in sillycat-favorite project, customer-login is just user login with customer things.
customer-login-twice is login with google account twice. First time is for basic authentication, second time is for more authorizations.
Some Details and Codes Sample are as follow
First login handler
Template.user_loggedout.events({
"click #login": function(e, tmpl){
// var scopes = ['https://www.googleapis.com/auth/gmail.readonly',
// 'https://www.googleapis.com/auth/userinfo.profile'];
var scopes = ['https://www.googleapis.com/auth/gmail.readonly'];
Meteor.loginWithGoogle({
requestPermissions: scopes,
forceApprovalPrompt: false,
loginHint: "cluo@jobs2careers.com",
//userEmail: "cluo@jobs2careers.com",
//loginStyle: "redirect",
loginStyle: "popup",
requestOfflineToken: true
}, function(err) {
if(err) {
//error handling
alert('error : '+ err);
throw new Meteor.Error(Accounts.LoginCancelledError.numericError, 'Error');
} else {
//show an alert
//alert('logged in');
console.log("first login .....");
Session.set("previousUser", "cluo@jobs2careers.com");
}
});
}
});
Second Login handler
Template.content.events({
"click #loginOther": function(e, tmpl){
// var scopes = ['https://www.googleapis.com/auth/gmail.readonly',
// 'https://www.googleapis.com/auth/userinfo.profile'];
var scopes = ['https://www.googleapis.com/auth/gmail.readonly'];
Meteor.loginWithGoogle({
requestPermissions: scopes,
forceApprovalPrompt: false,
loginHint: "yiyikangrachel@gmail.com",
//loginStyle: "redirect",
loginStyle: "popup",
requestOfflineToken: true
}, function(err) {
//console.log("recall from login second.");
if(err) {
//error handling
alert('error : '+ err);
throw new Meteor.Error(Accounts.LoginCancelledError.numericError, 'Error');
} else {
//show an alert
//alert('logged in');
console.log("second login .....");
var user2 = Session.get("previousUser");
console.log("previous user = " + user2);
}
});
}
});
You can have a settings.json to including all the configuration.
{
"google_clientId" : “xxx",
"google_secret" : “xxx",
"githubClientID" : “xxx",
"githubSecret" : “xxx"
}
You also need to create a mobile-config.js file to allow the app to access the google profile icons.
App.accessRule('https://*.googleusercontent.com');
On the server side, we need to set up the things, not to write any security information to our database.
(function(){
Meteor.startup(function () {
Accounts.loginServiceConfiguration.remove({
service: "google"
});
Accounts.loginServiceConfiguration.insert({
service: "google",
clientId: Meteor.settings.google_clientId,
secret: Meteor.settings.google_secret
});
});
Accounts.onCreateUser(function (options, user) {
var accessToken = user.services.google.accessToken,
result,
profile;
console.log("accessToekn=" + accessToken);
result = Meteor.http.get("https://www.googleapis.com/oauth2/v3/userinfo", {
headers: {"User-Agent": "Meteor/1.0"},
params: {
access_token: accessToken
}
});
if (result.error)
throw result.error;
profile = _.pick(result.data,
"name",
"given_name",
"family_name",
"profile",
"picture",
"email",
"email_verified",
"birthdate",
"gender",
"locale",
"hd");
console.log(profile);
user.profile = profile;
console.log("try to remove all the things");
user.services.google = {};
return user;
});
}());
Command to start the iOS testing on real device
> meteor run ios-device --mobile-server xxxx.meteor.com
Deploy to meteor
> meteor --settings settings.json deploy xxxx.meteor.com
Running the application from testing env
> meteor --settings settings.json run ios
3. How I install the customized meteor
> git clone https://github.com/meteor/meteor.git meteor-official
Switch to the right version
> ./meteor --help
Sometimes you need to clean your system and your project as well.
> rm -fr ~/.meteor/
> rm -fr .meteor/local/*
> rm -fr /usr/local/bin/meteor
And I need to add customized meteor directory to PATH as well.
References:
plugin
https://github.com/rapito/meteor-contextio
working branch
https://github.com/meteor/meteor/tree/release-1.2
code changes I want to make
https://github.com/meteor/meteor/pull/2790/files
mobile configuration
https://docs.meteor.com/#/full/mobileconfigjs
1. First of All, Find a working Release on Meteor
Currently, the release version release-1.2 is working, so I branch from that release and create release-1.2.1 on my own fork.
https://github.com/luohuazju/meteor/tree/release-1.2.1.
The only changes I made there is to support the google hint email.
https://github.com/luohuazju/meteor/commit/0897eab2bfc71036a12b6550df76e2a8ff30f19f
var loginUrl = 'https://accounts.google.com/o/oauth2/auth?' +
_.map(loginUrlParameters, function(value, param){
return encodeURIComponent(param) + '=' + encodeURIComponent(value);
}).join("&");
if (options.loginHint) {
loginUrl += '&login_hint=' + encodeURIComponent(options.loginHint);
}
2. Make The Google Login working in Meteor
All the details are in sillycat-favorite project, customer-login is just user login with customer things.
customer-login-twice is login with google account twice. First time is for basic authentication, second time is for more authorizations.
Some Details and Codes Sample are as follow
First login handler
Template.user_loggedout.events({
"click #login": function(e, tmpl){
// var scopes = ['https://www.googleapis.com/auth/gmail.readonly',
// 'https://www.googleapis.com/auth/userinfo.profile'];
var scopes = ['https://www.googleapis.com/auth/gmail.readonly'];
Meteor.loginWithGoogle({
requestPermissions: scopes,
forceApprovalPrompt: false,
loginHint: "cluo@jobs2careers.com",
//userEmail: "cluo@jobs2careers.com",
//loginStyle: "redirect",
loginStyle: "popup",
requestOfflineToken: true
}, function(err) {
if(err) {
//error handling
alert('error : '+ err);
throw new Meteor.Error(Accounts.LoginCancelledError.numericError, 'Error');
} else {
//show an alert
//alert('logged in');
console.log("first login .....");
Session.set("previousUser", "cluo@jobs2careers.com");
}
});
}
});
Second Login handler
Template.content.events({
"click #loginOther": function(e, tmpl){
// var scopes = ['https://www.googleapis.com/auth/gmail.readonly',
// 'https://www.googleapis.com/auth/userinfo.profile'];
var scopes = ['https://www.googleapis.com/auth/gmail.readonly'];
Meteor.loginWithGoogle({
requestPermissions: scopes,
forceApprovalPrompt: false,
loginHint: "yiyikangrachel@gmail.com",
//loginStyle: "redirect",
loginStyle: "popup",
requestOfflineToken: true
}, function(err) {
//console.log("recall from login second.");
if(err) {
//error handling
alert('error : '+ err);
throw new Meteor.Error(Accounts.LoginCancelledError.numericError, 'Error');
} else {
//show an alert
//alert('logged in');
console.log("second login .....");
var user2 = Session.get("previousUser");
console.log("previous user = " + user2);
}
});
}
});
You can have a settings.json to including all the configuration.
{
"google_clientId" : “xxx",
"google_secret" : “xxx",
"githubClientID" : “xxx",
"githubSecret" : “xxx"
}
You also need to create a mobile-config.js file to allow the app to access the google profile icons.
App.accessRule('https://*.googleusercontent.com');
On the server side, we need to set up the things, not to write any security information to our database.
(function(){
Meteor.startup(function () {
Accounts.loginServiceConfiguration.remove({
service: "google"
});
Accounts.loginServiceConfiguration.insert({
service: "google",
clientId: Meteor.settings.google_clientId,
secret: Meteor.settings.google_secret
});
});
Accounts.onCreateUser(function (options, user) {
var accessToken = user.services.google.accessToken,
result,
profile;
console.log("accessToekn=" + accessToken);
result = Meteor.http.get("https://www.googleapis.com/oauth2/v3/userinfo", {
headers: {"User-Agent": "Meteor/1.0"},
params: {
access_token: accessToken
}
});
if (result.error)
throw result.error;
profile = _.pick(result.data,
"name",
"given_name",
"family_name",
"profile",
"picture",
"email",
"email_verified",
"birthdate",
"gender",
"locale",
"hd");
console.log(profile);
user.profile = profile;
console.log("try to remove all the things");
user.services.google = {};
return user;
});
}());
Command to start the iOS testing on real device
> meteor run ios-device --mobile-server xxxx.meteor.com
Deploy to meteor
> meteor --settings settings.json deploy xxxx.meteor.com
Running the application from testing env
> meteor --settings settings.json run ios
3. How I install the customized meteor
> git clone https://github.com/meteor/meteor.git meteor-official
Switch to the right version
> ./meteor --help
Sometimes you need to clean your system and your project as well.
> rm -fr ~/.meteor/
> rm -fr .meteor/local/*
> rm -fr /usr/local/bin/meteor
And I need to add customized meteor directory to PATH as well.
References:
plugin
https://github.com/rapito/meteor-contextio
working branch
https://github.com/meteor/meteor/tree/release-1.2
code changes I want to make
https://github.com/meteor/meteor/pull/2790/files
mobile configuration
https://docs.meteor.com/#/full/mobileconfigjs
发表评论
-
Stop Update Here
2020-04-28 09:00 262I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 432NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 311Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 323Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 294Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 381Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 374Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 327Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 399VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 337Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 417NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 360Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 293Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 209GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 392GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 276GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 265Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 260Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 252Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 237Serverless with NodeJS and Tenc ...
相关推荐
Customize Rules 使用附件中的 myrules 中的内容覆盖 Customize 的内容然后保存
Hybrid Mobile Development with Ionic by Gaurav Saini English | 27 Apr. 2017 | ASIN: B01NB154W2 | 242 Pages | AZW3 | 3.49 MB Build a complete, professional-quality, hybrid mobile application with ...
修复MyEclipse点击Customize Perspective没有反应
Use out-of-the-box Ionic functionalities, customize existing components, and add new components with this comprehensive course. Learn Ionic by creating three complete mobile applications Who This ...
这个压缩包包含myeclipse_2014_customize_perspective修复bug工具
Customize Word 2013 Keyboard Shortcuts
Qt仿照谷歌浏览器的Tab标签页,该Demo实现了新的谷歌浏览器的标签的外观和旧的谷歌浏览器的标签。简单的绘制了一下,如果需要也可以找我,共同学习,交流进步。zhouyohu@163.com
Building Tools with GitHub Customize Your Workflow 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
前端开源库-customize-engine-handlebars自定义引擎把手,将把手用作自定义引擎
Building Tools with GitHub Customize Your Workflow 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,...
customize sort.txt
解决myeclipse2014版本中不能启动Customize Perspective的替换补丁
customize
customize_service.py
myeclipse 2014 customize persperctive 无法 打开 修复 myeclipse 2014 customize persperctive 无法 打开 修复
myeclipse2014Customize Persperctive失效
将插件安装在Redmine插件目录中,将此存储view_customize为view_customize : cd {RAILS_ROOT}/plugins git clone https://github.com/onozaty/redmine-view-customize.git view_customize cd ../ bundle install -...
Myclipse2014 Customize Persperctive失效解决方案
Google Apps Script is a cloud-based scripting language based on JavaScript to customize and automate Google applications. Apps Script makes it easy to create and publish add-ons in an online store ...
Customize_checbox_src.zip