# A Simplified OAuth2 Library
## No special configuration required
No special configuration required, use the examples in the sample directory to run.
The default configuration has the following limitations:
Problem 1: Restarting the service will invalidate previous login information.
This is because fastoauth generates a random secret_key each time it starts, and tokens generated with the old secret_key will become invalid.
Problem 2: Tokens cannot be shared between multiple OAuth processes.
Since different processes generate different random secret_keys, tokens cannot be parsed by different processes.
Problem 3: Issued tokens cannot be revoked.
Since tokens are not stored by default and their validity is verified by decryption each time, issued tokens cannot be revoked within their validity period.
## Configuring the secret_key
It is generally recommended to set a secret_key or use Redis for better availability.
This can solve problems 1 and 2 in the default configuration.
> Note: After configuring Redis, the secret_key setting is invalid. Please refer to the Redis section for details.
---
Generating the secret_key
```
openssl rand -hex 32
```
If you don't have the openssl command, you need to install it separately.
```
# Installation on Windows, refer to https://zhuanlan.zhihu.com/p/108833705 for choco installation
choco install openssl -y
```
## Configuring Redis
It is generally recommended to configure Redis for the highest security.
After configuring Redis, all problems in the default configuration can be solved.
At the same time, after configuring Redis, only shorter tokens need to be used during HTTP transmission, and richer content can be stored in Redis.
# A simplified server-side example
In the project directory ./sample/oauth_server.py
Release files for fastoauth 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastoauth-0.1.10.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastoauth-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / fastoauth-0.1.10.tar.gz
| Download URL | fastoauth-0.1.10.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8319ff56fe5bf2358573701c353722d1cf20bb0242fb8d872d47cc86c51d93f2
|
|
BLAKE2b-256 checksum How to use checksums |
680f84f9f97a6affd766ee178f6c588ae0fb3ecea5c638db687fb259dee69bc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.7
|
Release files / fastoauth-0.1.10-py3-none-any.whl
| Download URL | fastoauth-0.1.10-py3-none-any.whl |
|---|---|
| Size | 11.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1f56e41d68927a57ba6a23f242f6e6a205efab96177e4b08a13b1b4df5d21fc
|
|
BLAKE2b-256 checksum How to use checksums |
8c6c0c0c39cbf53d3136ef661c455229d629876e07440824b50c0bf95a0f672e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.11.7
|