Skip to content

Instantly share code, notes, and snippets.

View spencercarli's full-sized avatar

Spencer Carli spencercarli

View GitHub Profile
@spencercarli
spencercarli / google-oauth.js
Created March 9, 2016 01:33
Setting up the Meteor Server - google-oauth.js
// MeteorApp/server/google-oauth.js
const settings = Meteor.settings.google;
if (settings) {
ServiceConfiguration.configurations.remove({
service: 'google'
});
ServiceConfiguration.configurations.insert({
@spencercarli
spencercarli / settings.json
Created March 9, 2016 01:33
Setting up the Meteor Server - settings.json
/* MeteorApp/settings.json */
{
"google": {
"clientId": "YOUR_APP_CLIENT_ID",
"secret": "YOUR_APP_SECRET"
}
}
@spencercarli
spencercarli / .gitignore
Created March 9, 2016 01:32
Setting up the Meteor Server - .gitignore
// MeteorApp/.gitignore
settings.json
@spencercarli
spencercarli / index.html
Created March 9, 2016 01:32
Setting up the Meteor Server - index.html
<!-- MeteorApp/client/index.html -->
<head>
<title>MeteorApp</title>
</head>
<body>
<h1>Welcome to Meteor!</h1>
{{> loginButtons}}
</body>
@spencercarli
spencercarli / ddp.js
Created February 16, 2016 01:06
Password Hashing for Meteor React Native - Implementation
// In RNApp/app/ddp.js
/*
* Removed from snippet for brevity
*/
ddpClient.signUpWithEmail = (email, password, cb) => {
let params = {
email: email,
password: ddpClient.sha256(password)
@spencercarli
spencercarli / ddp.js
Created February 16, 2016 01:06
Password Hashing for Meteor React Native - Hashing - Part 2
// In RNApp/app/ddp.js
/*
* Removed from snippet for brevity
*/
ddpClient.sha256 = (password) => {
return {
digest: hash.sha256().update(password).digest('hex'),
algorithm: "sha-256"
@spencercarli
spencercarli / ddp.js
Created February 16, 2016 01:05
Password Hashing for Meteor React Native - Hashing - Part 1
// In RNApp/app/ddp.js
import DDPClient from 'ddp-client';
import hash from 'hash.js';
import { AsyncStorage } from 'react-native';
let ddpClient = new DDPClient({
host: 'localhost',
port: '3000',
// url: <your websocket url>
});
@spencercarli
spencercarli / home.html
Created February 16, 2016 01:03
Password Hashing for Meteor React Native - Adding Accounts to the Meteor App
<!-- In /meteor-app/client/home.html -->
<template name="home">
{{> loginButtons}}
<h1>Post Count: {{count}}</h1>
<button id="increment">Increment</button>
<button id="decrement">Decrement</button>
</template>
@spencercarli
spencercarli / posts.js
Created February 14, 2016 20:48
Meteor Authentication from React Native - posts.js
// meteor-app/both/posts.js
'addPost': function() {
Posts.insert({
title: 'Post ' + Random.id(),
userId: this.userId
});
},
@spencercarli
spencercarli / loggedOut.js
Created February 14, 2016 20:47
Meteor Authentication from React Native - UI: Sign In - loggedOut.js
// RNApp/app/loggedOut.js
import React, {
View,
Text,
TextInput,
StyleSheet,
AsyncStorage // Import AsyncStorage
} from 'react-native';