Skip to navigation Skip to content
Simon Technology Blog
  • Architecture
  • Cloud
  • Database
  • Develop
  • Hardware
  • Industry
  • Language
  • Mobile
  • Opensource
  • OS
  • Web
Main Navigation

Hybrid(5)Customize Meteor Directly Google Login

October 8, 2021By Simo Hybrid

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) +’= ); }).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: “[email protected]”, // userEmail: “[email protected]”, // 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”, “[email protected]”); }} });}} }); Second Login handler}} }); Second Login handler Template.content.events({ “click #loginOther”: function(e, tmpl){ google/api/ https:// var scopes = [‘s. gmail.readonly’, //’https://www.googleapis.com/auth/userinfo.profile’]; var scopes = [‘https://www.googleapis.com/auth/gmail.read’]; or Mete .loginWithGoogle ({requestPermissions: scopes, forceApprovalPrompt: false, loginHint: “[email protected]”, // loginStyle: “redirect”, loginStyle: “popup”, requestOfflineToken: true}, function (err) {// console. log(“recall from logi n 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”); user v “previousUser”); user v “previousUser”); }} });}} }); You can have a settings.json to including all the configuration. {“google_clientId”: “xxx”, “google_secret”: “xxx”, “githubClientID”: “xxx “Secret,” “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,} access. }} }); Token access = ek console result, ek console result, ek “access. Meteor.http.get(“https://www.googleapis.com/oauth2/v3/userinfo”, {headers: {“User-Agent”: “Meteor/1.0”}, params: {access Token: access _token ; if (result.error) throw result.error; profile = _.pick (result.data, “name”, “given_name”, “family_name”, “profile”, “picture”, “ema il”, “email_verified”, “birthdate”, “gender”, “locale”, “locale”, console to “hd”); log console things; console to “hd”); ; 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

customize, directly, Google, Hybrid, login, Meteor

Post navigation

COCOS2D-JS implementation Map Vector
Cordova – Media.getduration Returns -1

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3814 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment Cancel reply

Your email address will not be published.

Recent Posts
  • Sencha-Touch-2 – Sencha Touch 2, Nested XML Analysis NodeValue
  • Add a separation line and format XML content
  • Is there a norm of simplified XML subsets?
  • Look at it when you write React
  • ReactJS – Present React Redux React-Router App to add the server to the Firebase hosted by the Firebase
Categories
  • Android
  • Apache
  • Apache Kafka
  • Asp
  • Auto-Test
  • Automated Build
  • Aws
  • Bitcoin
  • Browser
  • C & C++
  • C#
  • Centos
  • Cgi
  • Character
  • Cloud Service
  • Cocos2dx
  • Cordova
  • CSS
  • Data Structure
  • Delphi
  • Design Pattern
  • Dojo
  • Dubbo
  • ELK
  • Flex
  • football
  • Game
  • Hadoop
  • Hibernate
  • HTML
  • Hybrid
  • Intel
  • IOS
  • Ipad
  • iPhone
  • Java
  • Javascript
  • Jetty
  • JQuery
  • Jsp
  • Linux
  • Load Balance
  • Lua
  • Macbook
  • Macos
  • Mathematics
  • Micro Services
  • Monitoring
  • Motherboard
  • Mysql
  • Network Hardware
  • Network Marketing
  • Nginx
  • NodeJs
  • Nosql
  • Oracle
  • Os Theory
  • Performance
  • PHP
  • Postgresql
  • Power Designer
  • React
  • Redis
  • Regexp
  • Rom
  • Rss
  • Ruby
  • Search Engines
  • Shell Script
  • Silicon Valley
  • Silverlight
  • Software Design
  • Spring
  • Sql
  • Sqlite
  • Sqlserver
  • Storage
  • Storm
  • Surface
  • SVN
  • Swift
  • System Architecture
  • Tablet
  • Uncategorized
  • Unix
  • Visual Basic
  • Visual Studio
  • Web Crawler
  • WebService
  • Windows
  • Wireless
  • XML
  • ZooKeeper
Archives
  • October 2021
  • September 2021
  • August 2021
  • May 2021
  • April 2021
  • September 2020
  • September 2019
  • August 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
© Simon Technology Blog 2025 • ThemeCountry Powered by WordPress