mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 17:16:34 +03:00
revised README.md.
This commit is contained in:
parent
5a9f5afc36
commit
e19377e093
91
README.md
91
README.md
|
@ -24,31 +24,27 @@ Installation
|
||||||
|
|
||||||
3. Add rest_auth app to INSTALLED\_APPS in your django settings.py
|
3. Add rest_auth app to INSTALLED\_APPS in your django settings.py
|
||||||
|
|
||||||
> INSTALLED\_APPS = (
|
INSTALLED_APPS = (
|
||||||
>
|
...,
|
||||||
> ...,
|
'rest_auth',
|
||||||
>
|
)
|
||||||
> 'rest_auth',
|
|
||||||
> )
|
|
||||||
|
|
||||||
4. This project depends on django-rest-framework library, therefore the following REST_FRAMEWORK settings needs to be entered in your Django settings.py::
|
4. This project depends on django-rest-framework library, therefore the following REST_FRAMEWORK settings needs to be entered in your Django settings.py::
|
||||||
|
|
||||||
> REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
>
|
'DEFAULT_AUTHENTICATION_CLASSES': (
|
||||||
> 'DEFAULT_AUTHENTICATION_CLASSES': (
|
'rest_framework.authentication.SessionAuthentication',
|
||||||
> 'rest_framework.authentication.SessionAuthentication',
|
),
|
||||||
> ),
|
|
||||||
>
|
'DEFAULT_PERMISSION_CLASSES': (
|
||||||
> 'DEFAULT_PERMISSION_CLASSES': (
|
'rest_framework.permissions.IsAuthenticated'
|
||||||
> 'rest_framework.permissions.IsAuthenticated'
|
)
|
||||||
> )
|
}
|
||||||
> }
|
|
||||||
|
|
||||||
5. Lastly, this project accepts the following Django setting values. You can set the UserProfile model and/or create your own REST registration backend for django-registration.
|
5. Lastly, this project accepts the following Django setting values. You can set the UserProfile model and/or create your own REST registration backend for django-registration.
|
||||||
|
|
||||||
> REST\_REGISTRATION\_BACKEND = 'rest\_auth.backends.rest\_registration.RESTRegistrationView'
|
REST_REGISTRATION_BACKEND = 'rest_auth.backends.rest_registration.RESTRegistrationView'
|
||||||
>
|
REST_PROFILE_MODULE = 'accounts.UserProfile'
|
||||||
> REST\_PROFILE\_MODULE = 'accounts.UserProfile'
|
|
||||||
|
|
||||||
6. You're good to go now!
|
6. You're good to go now!
|
||||||
|
|
||||||
|
@ -56,58 +52,31 @@ API endpoints without Authentication
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
1. /rest\_accounts/register/ - POST
|
1. /rest\_accounts/register/ - POST
|
||||||
|
- username
|
||||||
Parameters
|
- password
|
||||||
|
- email
|
||||||
username, password, email, first\_name, last\_name
|
- first\_name
|
||||||
|
- last\_name
|
||||||
2. /rest\_accounts/password/reset/ - POST
|
2. /rest\_accounts/password/reset/ - POST
|
||||||
|
- email
|
||||||
Parameters
|
|
||||||
|
|
||||||
email
|
|
||||||
|
|
||||||
3. /rest\_accounts/password/reset/confirm/{uidb64}/{token}/ - POST
|
3. /rest\_accounts/password/reset/confirm/{uidb64}/{token}/ - POST
|
||||||
|
- new\_password1
|
||||||
Django URL Keywords
|
- new\_password2
|
||||||
|
|
||||||
uidb64, token
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
|
|
||||||
new\_password1, new\_password2
|
|
||||||
|
|
||||||
4. /rest\_accounts/login/ - POST
|
4. /rest\_accounts/login/ - POST
|
||||||
|
- username
|
||||||
Parameters
|
- password
|
||||||
|
|
||||||
username, password
|
|
||||||
|
|
||||||
5. /rest\_accounts/verify-email/{activation\_key}/ - GET
|
5. /rest\_accounts/verify-email/{activation\_key}/ - GET
|
||||||
|
|
||||||
Django URL Keywords
|
|
||||||
|
|
||||||
activation_key
|
|
||||||
|
|
||||||
API endpoints with Authentication
|
API endpoints with Authentication
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
1. /rest\_accounts/logout/ - GET
|
1. /rest\_accounts/logout/ - GET
|
||||||
|
|
||||||
2. /rest\_accounts/user/ - GET & POST
|
2. /rest\_accounts/user/ - GET & POST
|
||||||
|
- user as dictionary with id, email, first\_name, last\_name
|
||||||
GET Parameters
|
"user": {"id": 1, "first_name": "Person", "last_name": "2"}
|
||||||
|
- user-defined UserProfile model fields
|
||||||
POST Parameters
|
|
||||||
|
|
||||||
user as dictionary with id, email, first\_name, last\_name
|
|
||||||
|
|
||||||
Ex) "user": {"id": 1, "first\_name": "Person", "last\_name": "2"}
|
|
||||||
|
|
||||||
user-defined UserProfile model fields
|
|
||||||
|
|
||||||
3. /rest\_accounts/password/change/ - POST
|
3. /rest\_accounts/password/change/ - POST
|
||||||
|
- new\_password1
|
||||||
Parameters
|
- new\_password2
|
||||||
|
|
||||||
new\_password1, new\_password2
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user