Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 = (


Please login. Go back to the main page.

);
```

## Production ready

We are using `meteor-auth` in [RemoteBase](https://remotebase.io) to serve
actual users.

![](https://cldup.com/QUydmNJ7Ea.gif)

## License

MIT