authonice-mithril

0.0.9 • Public • Published

authonice logo

authonice (mithril)

IN PROGRESS: not ready, yet

This is the authonice frontend for mithril.

npm Build Status Code Climate

authonice is a platform/language/framework agnostic ecosystem for web-app authentication, with lots of inspiration from satellizer.

It's designed to work with lots of backend languages, auth services, & frontend frameworks. It's goal is to make you super-happy because your sites are safe, easy to setup & maintain, and stylishly locked-down in your language/frameworks of choice.

If we don't have a module for the frontend-framework/backend-language/auth-service you want to support, ask us or contribute!

installation

You can install with bower, npm, download or just add script tags to your HTML.

webpack/browserify/etc

var authonice = require('authonice-mithril');

requirejs

define(['mithril','authonice-mithril'], function(m, authonice){
  
});

plain browser globals

<script src="https://cdnjs.cloudflare.com/ajax/libs/mithril/0.1.30/mithril.min.js"></script>
<script src="https://rawgit.com/authonice/front-mithril/master/dist/authonice-mithril.min.js"></script>

usage

The API is très simple:

  • loggedIn() - does the user have a token?
  • login(email, password) - trade credentials for a token
  • logout() - forget token
  • register(email, password) - save some login credentials
  • verify(token) - prove that the user got an email (or read the console or whatever)
  • user() - get the current server-side user
  • req() - a wrapper for m.request that ensures authentication & defaults to GET

For an in-depth example see demo-node-mithril

Package Sidebar

Install

npm i authonice-mithril

Weekly Downloads

1

Version

0.0.9

License

MIT

Last publish

Collaborators

  • konsumer