Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harshuljain13/djangorestauth
This Repository consists of implementation of various authentication techniques used in djangoRestFramework.
https://github.com/harshuljain13/djangorestauth
authentication django-rest-framework rest-api
Last synced: 5 days ago
JSON representation
This Repository consists of implementation of various authentication techniques used in djangoRestFramework.
- Host: GitHub
- URL: https://github.com/harshuljain13/djangorestauth
- Owner: harshuljain13
- Created: 2017-02-26T14:12:31.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-06-10T19:41:27.000Z (over 3 years ago)
- Last Synced: 2024-11-08T01:46:47.440Z (about 2 months ago)
- Topics: authentication, django-rest-framework, rest-api
- Language: Python
- Homepage:
- Size: 23.4 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DjangoRestAuth
This Repository consists of implementation of various authentication techniques used in djangoRestFramework.```
git clone https://github.com/harshul1610/DjangoRestAuth.git
virtualenv -p python venv
source venv/bin/activate
pip install -r requirements.txt
python manage.py migrate
python manage.py shell
>>> from django.contrib.auth.models import User
>>> u = User.objects.create_user('harshul','[email protected]','harshulpass')
>>> u.save()
```## Basic Authentication in Homeapp
### Get Data providing Username and Password
```
curl -X GET http://127.0.0.1:8000/notes/ -u harshul:harshulpass
```
### Post Data providing Username and Password
```
curl -d "note_title=https://harshul1610.github.io¬e_description=this is my personal site and blog domain" http://127.0.0.1:8000/notes/ -u harshul:harshulpass
```## TokenAuthentication in Tokenapp
### Get Token
```
curl -d "username=harshul&password=harshulpass" http://127.0.0.1:8000/api-token-auth/
```
### Post data using Token
```
curl -d "url_title=https://harshul1610.github.io&url_description=this is my personal site and blog domain" http://127.0.0.1:8000/urls/ -H 'Authorization: Token e91c548ad661f7ff3e74813dfb06d18a9c6daee3'
```
### Get Data using Token
```
curl -X GET http://127.0.0.1:8000/urls/ -H 'Authorization: Token e91c548ad661f7ff3e74813dfb06d18a9c6daee3'
```