# Authentication ## User Registration | requests | info | | :---: | :--- | | endpoint | `/registration/` | | method | `POST` | | Authorization | none | | desc | the userType param is used to determine whether the registration is for coach or normal user | payload: | key | type | remarks | | :---: | :---: | :---: | | email | String | required | | password1 | String | required | | password2 | String | required | | username | String | required | | userType | Integer | 0: user (default),
1: coach | ## Custom Confirm Email Address | requests | info | | :---: | :--- | | endpoint | `/registration/verify-email/` | | method | `POST` | | Authorization | none | | desc | perform email confirmation by input verification key string instead of by clicking the confirmation link | payload: | key | type | remarks | | :---: | :---: | :---: | | key | String | required | ## Login | requests | info | | :---: | :--- | | endpoint | `/auth/login/` | | method | `POST` | | Authorization | none | | desc | a token will be return for authorization | payload: | key | type | remarks | | :---: | :---: | :---: | | email | String | required | | password1 | String | required | | password2 | String | required | | username | String | required | | userType | Integer | 0: user (default),
1: coach | ## Social Auth (Facebook) | requests | info | | :---: | :--- | | endpoint | `/registration/facebook/` | | method | `POST` | | Authorization | none | | desc | - | payload: | key | type | remarks | | :---: | :---: | :---: | | access_token | String | required | | code | String | required | ## Social Auth (Google) | requests | info | | :---: | :--- | | endpoint | `/registration/google/` | | method | `POST` | | Authorization | none | | desc | - | payload: | key | type | remarks | | :---: | :---: | :---: | | access_token | String | required | | code | String | required | ## Request Password Reset | requests | info | | :---: | :--- | | endpoint | `/auth/password/reset/` | | method | `POST` | | Authorization | none | | desc | a confirmation email will be sent to the registered email | payload: | key | type | remarks | | :---: | :---: | :---: | | email | String | required | ## Confirm Password Reset | requests | info | | :---: | :--- | | endpoint | `/auth/password/reset/confirm/` | | method | `POST` | | Authorization | none | | desc | submit the new password together with the uidb64-token string received from the reset email | payload: | key | type | remarks | | :---: | :---: | :---: | | password1 | String | required | | password2 | String | required | | uid | String | required | | token | String | required | ## Change Password | requests | info | | :---: | :--- | | endpoint | `/auth/password/change/` | | method | `POST` | | Authorization | required | | desc | - | payload: | key | type | remarks | | :---: | :---: | :---: | | new_password1 | String | required | | new_password2 | String | required | ## Get Self Info (User) | requests | info | | :---: | :--- | | endpoint | `/auth/user/` | | method | `GET` | | Authorization | required | | desc | return a user object | payload: | key | type | remarks | | :---: | :---: | :---: | | - | - | - | response: ``` { "pk": Integer, "username": String, "email": String, "approved": Boolean, "group": { "id": Integer, "name": String, "permissions": [] }, "avatar": String } ```