Skip to main content
Dajgno TU Authentication
========================

Requirements
============
- python (2.7, 3.5)
- django (1.11, 2.0)
- social-app-django (2.1.0)

Installation
============
```
pip install git+https://github.com/LeOntalEs/django-tuauth.git
```

Usage
=====
### Prerequisite
Register application in api.tu.ac.th/applications
> note: Callback URL must be same with decarelation in urls.py
> in this example use http://127.0.0.1/oauth/complete/tu/

### in setting.py
```python
INSTALLED_APPS = [
...
'social_django',
'tuauth',
...
]
```
add authentication backend in setting.py
```python
AUTHENTICATION_BACKENDS = (
...
'tuauth.backend.TUOAuth2',
...
)
```
set client id and client secret in setting.py
```python
SOCIAL_AUTH_TU_KEY = '<client_id>'
SOCIAL_AUTH_TU_SECRET = '<client_secret>'
```

Sample SOCIAL_AUTH_PIPELINE
```python
SOCIAL_AUTH_PIPELINE = [
'social_core.pipeline.social_auth.social_details',
'social_core.pipeline.social_auth.social_uid',
'social_core.pipeline.social_auth.social_user',
'social_core.pipeline.user.get_username',
'social_core.pipeline.user.create_user',
'social_core.pipeline.social_auth.associate_user',
'social_core.pipeline.social_auth.load_extra_data',
'social_core.pipeline.user.user_details',
'social_core.pipeline.social_auth.associate_by_email',
]
```
> See more detail in about **social-app-django** in (https://github.com/python-social-auth/social-app-django)

### in urls.py
```
urlpatterns = [
...
path('oauth/', include('social_django.urls', namespace='social')), # in django2
...
]
```

### in template
```
...
<a href="{% url 'social:begin' 'tu' %}">Login with TU</a><br>
...
```


Metadata

Release files for django-tuauth 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tuauth 1.0
File Size Uploaded
django-tuauth-1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-tuauth 1.0
File Interpreter ABI Platform
django_tuauth-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / django-tuauth-1.0.tar.gz

Download URL django-tuauth-1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
84f80f3a92becb28d30bdc79aba168c9c9c712578bd507489afc06894bdbc76c
BLAKE2b-256 checksum
How to use checksums
a3ecdf7d04fd1e465f0d43f761fe7d81eb87a759bcac4f2410e9b9792d3db66c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release files / django_tuauth-1.0-py3-none-any.whl

Download URL django_tuauth-1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d73b05ce712143708139374153cfe63ea262fb669b459139d2e86a7965e84d66
BLAKE2b-256 checksum
How to use checksums
2a13e87fbc6ec07b5e70650788eb105f6e93c1d0ad4f8e424166839dcdf7e0a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page