Demo: https://auth0.xcv58.org
Auth0 is an authentication broker that supports social identity providers as well as enterprise identity providers such as Active Directory, LDAP, Google Apps and Salesforce.
Lock makes it easy to integrate SSO in your app. You won't have to worry about:
- Having a professional looking login dialog that displays well on any device.
- Finding the right icons for popular social providers.
- Solving the home realm discovery challenge with enterprise users (i.e.: asking the enterprise user the email, and redirecting to the right enterprise identity provider).
- Implementing a standard sign in protocol (OpenID Connect / OAuth2 Login)
- Integrates your Meteor app with Auth0
- Provides a beautiful native UI to log your users in.
- Provides support for Social Providers (Facebook, Twitter, etc.), Enterprise Providers (AD, LDAP, etc.) and Username & Password.
- Provides support for Meteor accounts so you develop your Meteor app as usual, in a clean and stright-forward way.
You'll need Meteor 1.6.1+.
Lock is available through Atmosphere. To install it, simply run the following command in your project folder:
meteor add xcv58:auth0-lock
Create a file named settings.json
in your project folder. This file should have your Auth0 ClientId and Domain that you can get from our dashboard.
{
"public": {
"AUTH0_CLIENT_ID": "YOUR_CLIENT_ID",
"AUTH0_DOMAIN": "YOUR_AUTH0_DOMAIN"
}
}
Please remember to replace the respective values.
This Meteor package gives you access to an instance of Lock that is instantiated for you and stored in the global lock
variable. There is no need to call new Auth0Lock(...);
since this is already done by the package.
You can call any of the Lock methods on this instance, and pass any of the options detailed in the documentation referenced below.
For example, you may call from inside a click event handler:
import { Meteor } from 'meteor/meteor';
import { initLock } from 'meteor/xcv58:auth0-lock';
Meteor.startup(function () {
// This is required to handle login
const Lock = initLock();
Lock.show();
})
You are able to customize the Lock
instance as well by calling initLock
method. You can find example in https://github.com/xcv58/meteor-auth0/blob/master/examples/sample-app/client/main.js.
Any documented combination is valid.
To log out, you can just call Meteor.logout();
if you just want to log the user out of your app.
Or you may call Lock.logout();
if you want to log the user out of the social provider, for instance, but this will redirect the user outside your app to the social provider log out site.
To show any of the user details after logging in, you can use the currentUser
helper in any of your Handlebar templates.
You will find the user profile under currentUser.services.auth0
.
{{> userName}}
<template name="userName">
{{currentUser.services.auth0.name}}
</template>
You can access the user profile from the server through the Meteor.user()
global getter, under the services.auth0
object.
const userName = Meteor.user().services.auth0.name;
You can find the full documentation for Lock on the Auth0 docs site.
- Complete API
- UI customization
- Single Page Applications implementation notes.
- Regular Web Applications implementing notes.
- Overlay vs Embedded mode
- Popup vs Redirect mode notes. What are the authentication modes?.
- Error customization notes.
- I18n notes.
- Events notes.
- Development notes.
- Release process notes.
- Auth0Lock playground
- Using Refresh Tokens
The examples/sample-app directory has a ready-to-go app. In order to run it you need Meteor installed.
Then execute meteor --settings production.settings.json
from the root of the example.
Finally, point your browser at http://localhost:3000/
and play around.
We ensure browser compatibility in Chrome
, Safari
, Firefox
and IE >= 9
. We currently use zuul along with Saucelabs to run integration tests on each push.
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
An Atmosphere account for Auth0 should be created under the name auth0
to make it possible to call the package auth0:lock
as indicated in package.js
.
The repo has to be cloned locally, and inside the lock
folder (package folder) the following command must be run:
meteor publish --create
If the auth0
account credentials for Atmosphere were used during the Meteor installation, those credentials will be used to push the package to Atmosphere.
If they were not, then they will be asked for after the previous command is run for the first time and cached thereafter.
This will publish the package, make it available in Atmosphere as well as creating a package site there.