npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-simple-auth-parse

v0.0.7

Published

ember-simple-auth integration for Parse

Downloads

6

Readme

ember-simple-auth-parse

Disclaimer: this library is currently preliminary and untested

Installation

  • ember install ember-simple-auth-parse

Usage

A (mostly) complete example implementation can be found in the dummy app. Until routeable components are released, the dummy app will have route templates that contain only a single line, rendering a component.

This library depends on ember-parse-adapter and ember-simple-auth to provide simple user authentication for Parse in Ember. You should already be familiar with ember-simple-auth and the parseUser model from ember-parse-adapter to use this library.

Authenticator

This library registers several authenticators to authenticate with Parse. These can used directly with the authenticate method, or using the LoginControllerMixin on controllers or components (see dummy app for example of using the mixin).

  • parse-user

    this.get('session').authenticate('authenticator:parse-user', {
      identification: '[email protected]', // corresponds to username on Parse
      password: 'coolpassword'
    });
  • parse-token: This authenticator is especially useful when you already have the session token (e.g. if you've just created a user)

    this.get('session').authenticate('authenticator:parse-token', {
      sessionToken: 'r:pnktnjyb996sj4p156gjtp4im'
    });

Authorizer

The supplied authorizer is called parse and will automatically add the session token to the appropriate header for ajax requests to the Parse API. To use, you will need to set the appropriate configuration options in config/environment.js.

Note: the cross origin whitelist must include Parse to allow ember-simple-auth to add the headers to the correct requests.

// config/environment.js
var ENV = {
  // ...

  'simple-auth': {
    authorizer: 'authorizer:parse',
    crossOriginWhitelist: ['https://api.parse.com']
  }
};

Current User

This library reopens the ember-simple-auth session object to add a currentUser property, which is updated any time the session is authenticated. This can be used in templates if the ApplicationRouteMixin is used, as well as the model of, say, a route users.current

// app/routes/users/current.js
import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';

export default Ember.Route.extend(AuthenticatedRouteMixin, {
  model: function() {
    // an instance of the parseUser model
    return this.get('session.currentUser');
  }
});

Authenticating on signup

A common use case not covered directly by ember-simple-auth is to authenticate immediately upon sign up. This is relatively straightforward using this library.

var user = this.store.createRecord('parseUser', {
  username: '[email protected]',
  password: 'coolpassword'
});

user.save().then(function(){
  this.get('session').authenticate('authenticator:parse-token', {
    sessionToken: user.get('sessionToken')
  });
}.bind(this));

Running Tests

  • ember test
  • ember test --server