· 9 years ago · Nov 30, 2016, 11:10 AM
1Snapcart Api Auth Microservice
2==============================
3
4# List of Contents:
5
61. [Flows description](#flows-description)
72. [REST Api Layer](#rest-api-layer)
83. [CLI Layer](#cli-layer)
94. [Models](#models)
105. [Development Guide](#development-guide)
116. [Dependencies](#dependencies)
12
13<a name="flows-description"></a>
14Flows description
15----------------------
16
17
18### 1.1. Client and grant types
19
20`Client` is an instance of connecting application (android, ios, kazbek, admin and many others, which may use it).
21To create `Client` please use [CLI commands](#cli-layer).
22Each client has:
23
24- `name` like `app_android`, `app_ios`, `web_admin`, `web_kazbek`
25- `id` + `_` + `random_id` is a `public_key`
26- when we send request to any endpoint (while `access_token` not attached) we should attach in headers `secret_key` and `public_key`
27- additional `Client`'s `grant_type`s are: `register`, `change_password`, `verify`.
28
29
30### 1.2. Usage
31
321. Registration (used grant types are: `register`, `verify`):
33 - First of all we need to [register](#rest-api-layer).
34 - Registration requires email and password
35 - Registration via Facebook = login via facebook, because if facebook_id not found - we create new one.
36 - After registration with email user is not verified.
37 - To verify user needs to send verification code on the verification endpoint
382. Authentication (used grant types are: `https://facebook.com`, `password`):
39 - to authenticate user you need to send request with `grant_type` = `password` or `https://facebook.com/`.
40 - If you authenticate via facebook, then it might be registration.
413. Forget password / Change password (used grant types are: `reset_password`, `change_password`):
42 - User requests reset password with inputted email, which we have in our database
43 - To change password client should send secret token and new password.
44
45
46
47<a name="rest-api-layer"></a>
48Rest Api Layer
49------------------------
50
51[auto-generated documentation](http://auth.api.sc.local/_doc/user_incent)
52
53<a name="cli-layer"></a>
54CLI Layer
55------------------------