How to use the simperium.Auth function in simperium

To help you get started, we’ve selected a few simperium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / simplenote-electron / lib / boot.js View on Github external
import { Provider } from 'react-redux';
import { get, some } from 'lodash';

import '../scss/style.scss';

import { content as welcomeMessage } from './welcome-message';

import appState from './flux/app-state';
import isDevConfig from './utils/is-dev-config';
import { normalizeForSorting } from './utils/note-utils';
const { newNote } = appState.actionCreators;

const config = getConfig();

const cookie = parse(document.cookie);
const auth = new Auth(config.app_id, config.app_key);
const appProvider = 'simplenote.com';

const appID = config.app_id;
let token = cookie.token || localStorage.access_token;

// Signs out the user from app engine and redirects to signin page
const redirectToWebSigninIfNecessary = () => {
  if (!config.is_app_engine) {
    return;
  }

  if (window.webConfig && window.webConfig.signout) {
    window.webConfig.signout(function() {
      window.location = `${config.app_engine_url}/`;
    });
  }
github Automattic / simplenote-electron / lib / boot.js View on Github external
import { Provider } from 'react-redux';
import { get, some } from 'lodash';

import '../scss/style.scss';

import { content as welcomeMessage } from './welcome-message';

import appState from './flux/app-state';
import isDevConfig from './utils/is-dev-config';
import { normalizeForSorting } from './utils/note-utils';
const { newNote } = appState.actionCreators;

const config = getConfig();

const cookie = parse(document.cookie);
const auth = new Auth(config.app_id, config.app_key);
const appProvider = 'simplenote.com';

const appID = config.app_id;
let token = cookie.token || localStorage.access_token;

// Redirect to web sign in if running on App Engine
if (!token && config.is_app_engine) {
  window.location = `${config.app_engine_url}/login/`;
}

const client = initClient({
  appID,
  token,
  bucketConfig: {
    note: {
      beforeIndex: function(note) {
github Automattic / simplenote-electron / lib / simperium / index.js View on Github external
import simperium, { Client } from 'simperium';
import store_provider from './store-provider';
import ghost_store from './ghost-store';
import localQueueStore from './local-queue-store';
import util from 'util';
import events from 'events';

export const Auth = simperium.Auth;

export default function(settings) {
  const browserClient = new BrowserClient(settings);

  window.addEventListener('beforeunload', () => {
    Object.values(browserClient.buckets).forEach(localQueueStore.persist);
  });

  return browserClient;
}

Client.Bucket.prototype.query = function(fn) {
  this.store.setup.then(fn);
};

function BrowserClient({ appID, token, bucketConfig, database, version }) {

simperium

A simperium client for node.js

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

52 / 100
Full package analysis