# ad-auth-system

> Store your users in the ADAuth API.

Latest version **1.0.0** (published 2019-01-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install ad-auth-system
pnpm add ad-auth-system
yarn add ad-auth-system
bun add ad-auth-system
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-22 |
| First published | 2019-01-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | Hassane |
| Maintainers | imthassane |
| Keywords | authentication, user system |

## Links

- npm: https://www.npmjs.com/package/ad-auth-system
- npm.io page: https://npm.io/package/ad-auth-system

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [sha256](https://npm.io/package/sha256.md) ^0.2.0

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-01-22

## README

# The auth-system package from Afro Develops Team.
This package only store user information but doesn't run sessions on our server.

## The User's informations
Since we are using Mongodb, the UserSchema is defined like so:



```
UserSchema = {
	username: { type: String, required: true },
	email: { type: String, required: true, unique: true },
	password: { type: String, required: true },
	birth_date: { type: String, required: true },
	first_name: String,
	last_name: String,
	avatar: String,
	created_at: { type: Date, default: Date.now() },
	updated_at: { type: Date, default: Date.now() }
}
```

## Functions available
The auth-system is a CRUD api, we can separate functions in 5 groups.

1. Create
    * createUser	
2. Read
	* getUsers (Get All Users)
	* getOneWithMail (Fetching one user knowing his mail address)
	* getOneWithUsername (Fetching one user knowing his username)
3. Update
	* updateWithMail (Updating one user using his mail address)
	* updateWithUsername (Updating one user using his username)
4. Delete
	* deleteWithMail (Deleting one user using his mail address)
	* deleteWithUsername (Deleting one user using his username)
	
## Usage's example for each function

### createUser
This function takes a User as parameter.
``` javascript
// Creating a new user on Nodejs.
router.post('/new', async (req, res) => {
	try {
		const { data } = await createUser(req.body)
		return res.send(data)
	} catch({ message }) {
		return res.send(message)
	}
})

```

### getUsers
This function retrieves all the users in the database.
``` javascript
// Fetching all users from a nodejs server.
router.get('/all', async (req, res) => {
	try {
		const { data } = await getUsers()
		return res.send(data)
	} catch({ message }) {
		return res.send(message)
	}
});

```

---
_Source: https://npm.io/package/ad-auth-system · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
