https://github.com/app-generator/flask-social-login
Flask Social Login - Open-Source Seed Project | AppSeed
https://github.com/app-generator/flask-social-login
appseed-sample flask social-login
Last synced: about 1 year ago
JSON representation
Flask Social Login - Open-Source Seed Project | AppSeed
- Host: GitHub
- URL: https://github.com/app-generator/flask-social-login
- Owner: app-generator
- Created: 2021-09-29T17:16:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-01T05:09:22.000Z (about 4 years ago)
- Last Synced: 2025-04-06T18:13:29.700Z (about 1 year ago)
- Topics: appseed-sample, flask, social-login
- Language: HTML
- Homepage: https://blog.appseed.us/flask-social-login-with-github/
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# [Flask Social Login](https://blog.appseed.us/flask-social-login-with-github/)
Open-source Flask sample built on top of `flask-dance` library. The project showcases the social login for Github - Features:
- Up-to-date [dependencies](./requirements.txt): **Flask 2.0.1**
- `OPENID` Social login over [Flask Dance](https://pypi.org/project/Flask-Dance/)
- Github Login
- Google Login (WIP)
- Support via **Github** (issues tracker) and [Discord](https://discord.gg/fZC6hup).

## Build from sources
> **Step #1** - Clone sources (this repo)
```bash
$ # Clone the sources
$ git clone https://github.com/app-generator/flask-social-login.git
$ cd flask-social-login
```
> **Step #2** - Create a virtual environment
```bash
$ # Virtualenv modules installation (Unix based systems)
$ virtualenv env
$ source env/bin/activate
$
$ # Virtualenv modules installation (Windows based systems)
$ # virtualenv env
$ # .\env\Scripts\activate
```
> **Step #3** - Install dependencies
```bash
$ # Install requirements
$ pip3 install -r requirements.txt
```
> **Step #4** - Set Up Environment
```bash
$ # Set the FLASK_APP environment variable
$ (Unix/Mac) export FLASK_APP=run.py
$ (Windows) set FLASK_APP=run.py
$ (Powershell) $env:FLASK_APP = ".\run.py"
```
> **Step #5** - [Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) (on Github)
- SignIN to Github
- Access `Settings` -> `Developer Settings` -> `OAuth Apps`
- Edit your OAuth App
- `App Name`
- `App Description`
- (mandatory) `HomePage`: `https://localhost:5000`
- (mandatory) `Authorization callback URL`: `https://localhost:5000/login/github/authorized`
- Generate a new `secret key`
> **Step #6** - Rename `.env.sample` to `.env` and edit the file
- `GITHUB_OAUTH_CLIENT_ID` - value provided by Github (step #5)
- `GITHUB_OAUTH_CLIENT_SECRET` - value provided by Github (step #5)
> **Step #7** - (optional) Enable DEBUG Environment (local development)
```bash
$ # Set up the DEBUG environment
$ (Unix/Mac) export FLASK_ENV=development
$ (Windows) set FLASK_ENV=development
$ (Powershell) $env:FLASK_ENV = "development"
```
> **Step #8** - Start the project (HTTPS)
```bash
$ flask run --cert=adhoc
$
$ # Access the app in browser: HTTPS://127.0.0.1:5000/
```
## Code-base structure
The project has a super simple structure, represented as bellow:
```bash
< PROJECT ROOT >
|
|-- app/
| |-- static/
| | |-- # CSS files, Javascripts files
| |
| |-- templates/
| | |
| | |-- index.html # Index File
| | |-- login.html # Login Page
| | |-- register.html # Registration Page
| |
| |
| config.py # Provides APP Configuration
| __init__.py # Bootstrap the project
|
|-- .env # Injects Github Credentials
|-- requirements.txt
|-- run.py
|
|-- ************************************************************************
```
## Resources
- Free [Admin Dashboards](https://appseed.us/admin-dashboards/open-source) - index provided by AppSeed
- [Flask User Authentication](https://blog.appseed.us/flask-user-authentication-free-sample/) - blog article (includes a free sample)
---
[Flask Social Login](https://blog.appseed.us/flask-social-login-with-github/) - Free sample provided by **AppSeed [App Generator](https://appseed.us/app-generator)**.