https://github.com/titomiguelcosta/lock
Playground for OAuth2 with Flask
https://github.com/titomiguelcosta/lock
flask oauth2 python
Last synced: 3 months ago
JSON representation
Playground for OAuth2 with Flask
- Host: GitHub
- URL: https://github.com/titomiguelcosta/lock
- Owner: titomiguelcosta
- Created: 2019-01-27T06:55:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T07:05:32.000Z (over 6 years ago)
- Last Synced: 2025-01-29T20:44:15.160Z (5 months ago)
- Topics: flask, oauth2, python
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Docs
Read the [official documentation](https://flask-oauthlib.readthedocs.io/en/latest/oauth2.html#example-for-oauth-2)
1. Install dependencies $ pip install -r requirements.txt
1. Start the server by executing $ python server.py
1. Database will be created and populates with dummy data## Authorize
First authorize by passing the client_id, client_secret, username and password and grab the CODE from the response
```curl -vvv -X GET "http://localhost:8080/oauth/authorize?response_type=code&client_id=confidential&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Fauthorized&scope=email+address&username=admin&password=112"```
## Token
Get the access token using the code from the previous call
```curl -X POST --data "code=
&grant_type=authorization_code&client_id=confidential&redirect_uri=http://localhost:8000/authorized&client_secret=confidential" "http://localhost:8080/oauth/token?response_type=code"```
## Test
Test calling the email endpoint
```curl -vvv -H "Authorization: Bearer " http://localhost:8080/api/email```
## ToDo
1. Encrypt password
1. Add permissions and roles per user