# Authentication

### We use 2 libraries to handle user authentication  [**@feathersjs/authentication**](https://github.com/feathersjs/authentication)  Feathers local, token, *and* OAuth authentication over REST and Websockets using JSON Web Tokens (JWT) with PassportJS.

\
[**feathers-authentication-management**](https://github.com/feathers-plus/feathers-authentication-management)\
Adds sign up verification, forgotten password reset, and other capabilities to local feathers-authentication

#### How to Create a new user?

```perl
curl -X POST \
  http://localhost:3030/users \
  -H 'Content-Type: application/json' \
  -H 'Postman-Token: 5ad6571f-e2dd-4737-b0e5-73d2fe8986fe' \
  -H 'cache-control: no-cache' \
  -d '{
	"email": "yourEmail@gmail.com",
	"password": "password"
}'
```

### How to Login?

```perl
curl -X POST \
  http://localhost:3030/authentication \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'Postman-Token: 5b8c84e3-303f-4eb2-9a24-06418fb7e8a8' \
  -H 'cache-control: no-cache' \
  -d 'email=doron.nahum%2B10%40gmail.com&password=password&strategy=local'
```

### How To disable the verify email service?

set false at verifyEmail.enable in the config file

<div align="left"><img src="https://1499183940-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-LYBD_UGcoq-fgbz0yN9%2F-LYBGbHUZP2k8fMF-Iz5%2FAnnotation%202019-02-08%20104259.jpg?alt=media&#x26;token=7b4a73e1-f674-4009-93c8-d0803f4c4e65" alt=""></div>

### How to customize the verify and the reset view?

replace this html files in your public folder

<div align="left"><img src="https://1499183940-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-LYBD_UGcoq-fgbz0yN9%2F-LYBHD8uM3NTLvpD-5GZ%2FAnnotation%202019-02-08%20104514.jpg?alt=media&#x26;token=c14a0914-1fad-4513-994d-9f40217586fb" alt=""></div>

![](https://1499183940-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LY13uPlo20E7hNPj1d2%2F-LfDQaeONaCcMBJRtmLH%2F-LfDRp4Q7Sl9wdIyBIau%2FScreen%20Shot%202019-05-19%20at%207.56.31.png?alt=media\&token=e82afb87-7362-419c-bbcc-7529bc4004ca)

## [**authentication-management**](https://github.com/feathers-plus/feathers-authentication-management) **end points**

## **Please read this document** [**https://github.com/feathers-plus/feathers-authentication-management/blob/master/docs.md**](https://github.com/feathers-plus/feathers-authentication-management/blob/master/docs.md)

```
fetch('/authManagement', {
  method: 'POST',
  headers: { Accept: 'application/json' },
  body: JSON.stringify(
    { action: <ACTION NAME>,
    value: <VALUE> 
  })
})
```

### 1. Resend Verify Signup

```
{ 'action':'resendVerifySignup',
'value':{ 'email':'userEaail@gmail.com' } }
```

### 2. Check Unique

```
{ 
  'action':'checkUnique', 
  'value':{
    'email':'userEaail@gmail.com'
  }
}
```

### 3. Verify Signup Long

```
{ 
  'action':'verifySignupLong', 
  'value':'281813b93785a68e7590833bed58e5' 
}
```

### 4. Password Change

```
{
 'action':'passwordChange', 
 'value':{ 
 'user':{ 'email':'userEmail@gmail.com' }, 
 'oldPassword':'password', 'password':'1234578' 
 }}
```

### 5. Send Reset Pwd

```
{
 'action':'sendResetPwd',
 'value':{ 
   'email':'userEmail@gmail.com' 
  }
}
```
