Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/remotebase/meteor-auth
A user authentication solution for Mantra applications
https://github.com/remotebase/meteor-auth
mantra meteor
Last synced: about 1 month ago
JSON representation
A user authentication solution for Mantra applications
- Host: GitHub
- URL: https://github.com/remotebase/meteor-auth
- Owner: remotebase
- License: mit
- Created: 2016-03-28T00:52:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-05T01:08:08.000Z (over 8 years ago)
- Last Synced: 2024-09-28T08:41:31.933Z (about 2 months ago)
- Topics: mantra, meteor
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 34
- Watchers: 2
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# meteor-auth
A user authentication solution for Mantra applications
## Installation
npm install -s meteor-auth
## Usage
This module includes:
* `authComposer`
* `EnsureLoggedIn`### authComposer
Compose a component with `authComposer` using `composeWithTracker`. The
component will reactively receive `loggedIn` and `loggingIn` props.*container*
```js
import {composeAll, composeWithTracker} from 'mantra-core';
import MyComponent from '../components/my_component.jsx';
import {authComposer} from 'meteor-auth';// ...
return composeAll(
composeWithTracker(authComposer),
)(MyComponent);
```*component*
```js
import React form 'react'const MyComponent = ({loggedIn, loggingIn}) => (
{
loggedIn ?Welcome:
loggingIn ?Loading...:Please log in
}
);
```### EnsureLoggedIn
Wrap a content with `` to make sure only logged in users can
see the content.```js
import React form 'react'
import {EnsureLoggedIn} from 'meteor-auth';const MyComponent = () => (
Welcome
);
```#### props
**unauthenticatedMessage**
* type: React component
* Replace the default component displayed when user is not logged in
* example:```js
const Dashboard = () => (
);const NotLoggedInMessage = (
);
```## Production ready
We are using `meteor-auth` in [RemoteBase](https://remotebase.io) to serve
actual users.![](https://cldup.com/QUydmNJ7Ea.gif)
## License
MIT