https://github.com/dmdhrumilmistry/sso-flask
SSO API written in python using flask framework
https://github.com/dmdhrumilmistry/sso-flask
aws dynamodb flask flask-application
Last synced: 2 months ago
JSON representation
SSO API written in python using flask framework
- Host: GitHub
- URL: https://github.com/dmdhrumilmistry/sso-flask
- Owner: dmdhrumilmistry
- License: mit
- Created: 2022-08-23T20:45:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-09-11T13:35:18.000Z (almost 4 years ago)
- Last Synced: 2025-09-06T22:44:42.170Z (10 months ago)
- Topics: aws, dynamodb, flask, flask-application
- Language: Python
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SSO Flask
A python application written using Flask to reduce creating passwords on several websites for logging in

## How websites can use it
- Ask user to Sign Up/Login using the hosted API
- Generate token for website domain
- Use generated token to authenticate user for accessing website
- Release generated token for the domain

## API endpoints
| Endpoint | METHOD | Params | Desc |
| :----------------------: | :----: | :-------------------: | :------------------------------------------------------------------------------------------------------- |
| /api/user/generate | POST | email, name | returns msg and authToken |
| /api/user/getId | POST | authToken | returns userId |
| /api/user/details | POST | authToken | returns user details (full name, tokens generated domains, and masked email id) |
| /api/user/token/generate | POST | authToken, id, domain | returns new token for requested website, use this endpoint to reset web token |
| /api/user/token/status | POST | authToken, id, domain | returns if token is still valid or not (should be used by website's backend server to get token status ) |
| /api/user/token/release | POST | authToken, id, domain | revokes token for assigned domain |
## Users table in DynamoDB
| id | name | emailId | auth_tokens |
| :----------------------------------: | :------------: | :------------------- | :--------------------------------------------------------------------- |
| 0e2xx8fc-5xex-47x1-99xx-0869adxxxxxx | your-full-name | your-email@domain.co | {"domain-01":"token-01","domain-02":"token-02","domain-03":"token-03"} |
## Installation and Usage
### For Debian based OSes
- Install curl
```bash
sudo apt install curl -y
```
- Use `install.sh` script from repo
```bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/dmdhrumilmistry/SSO-Flask/main/install.sh)"
```
### Manual Method
- Clone/Download repo
```bash
git clone --depth=1 https://github.com/dmdhrumilmistry/SSO-Flask.git
```
- Change directory
```bash
cd SSO-Flask
```
- Install requirements
```bash
python -m pip install -r requirements.txt
```
> ubuntu/debian users might need to use `python3` instead of `python`
- Create a new `.env` file with AWS creds in `SSO-Flask` directory
```bash
AWS_ACCESS_KEY_ID='aws-access-key-id'
AWS_SECRET_ACCESS_KEY='aws-secret-access-key'
AWS_REGION_NAME='your-aws-zone'
```
> Programmatic access is required to perform this action
- Start waitress server
```bash
waitress-serve --listen=*:5000 app:app
```
> Allow HTTP traffic on port 5000 for EC2 instance