Giter Site home page Giter Site logo

salte-auth's Introduction

OAuth 2.0 for the masses!

Docs โ€ข Demo

NPM Version NPM Downloads Travis Coveralls

semantic-release Greenkeeper badge

Supported Browsers

If a version isn't specified that means we test on the latest and greatest, however most versions of that browser should work.

Promise Polyfill

Here's a list of well known ES6 Promise implementations developed by the community!

Any other ES6 Promise implementation will work as well!

Install

You can install this package either with npm or with bower.

npm

$ npm install @salte-auth/salte-auth

Then add a <script> to your index.html:

<script src="/node_modules/@salte-auth/dist/salte-auth.js"></script>

Or require('@salte-auth/salte-auth') from your code.

bower

$ bower install salte-auth/salte-auth

Then add a <script> to your index.html:

<script src="/bower_components/salte-auth/dist/salte-auth.js"></script>

HTML Imports (Polymer 1.x - 2.x)

We also support HTML Imports:

<link rel="import" href="/bower_components/salte-auth/salte-auth.html">

ES6 Usage

import { SalteAuth } from '@salte-auth/salte-auth';

// Configure SalteAuth with Auth0's url and client id.
const auth = new SalteAuth({
  providerUrl: 'https://salte-os.auth0.com',
  responseType: 'id_token',
  redirectUrl: location.origin,
  clientId: '9JTBXBREtckkFHTxTNBceewrnn7NeDd0',
  scope: 'openid',

  routes: [
    'http://localhost:8080/account'
  ],

  endpoints: [
    'https://jsonplaceholder.typicode.com/posts/1'
  ],

  provider: 'auth0'
});

// Display an iframe to the user that allows them to login
auth.loginWithIframe();

ES5 Usage

<!DOCTYPE html>
<html>
  <head>
    <script src="/node_modules/@salte-auth/salte-auth/dist/salte-auth.js"></script>
    <script>
      const auth = new salte.SalteAuth({
        providerUrl: 'https://salte-alpha.auth0.com',
        responseType: 'id_token',
        redirectUrl: location.origin,
        clientId: 'mM6h2LHJikwdbkvdoiyE8kHhL7gcV8Wb',
        scope: 'openid',
        
        routes: [
          'http://localhost:8080/account'
        ],

        endpoints: [
          'https://jsonplaceholder.typicode.com/posts/1'
        ],

        provider: 'auth0',
      });

      auth.loginWithIframe();
    </script>
  </head>
  <body>
    ...
  </body>
</html>

Known Issues

These are issues that we know about, but don't have a clear fix for!

There are currently no known issues, thanks for checking!

Debugging

Debug logging can be enabled by setting a localStorage variable of debug to @salte-auth/salte-auth*.

Documentation

Click here to view the documentation!

Use private or undocumented methods at your own risk, as they will not require a major version bump when breaking changes are made!

Shoutouts

  • Auth0 - For providing us with an open source tenant!
JWT Auth for open source projects

salte-auth's People

Contributors

davewoodward avatar ducharmemp avatar greenkeeper[bot] avatar greenkeeperio-bot avatar jangolano avatar kpitzen avatar semantic-release-bot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.