• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    Python
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Google Firebase integration for Flask

Flask-Firebase

Google Firebase integration for Flask. At this moment, only the authentication subsystem is supported.

The extension works in two modes: development and production. In development, there is no communication with the Firebase system, accounts sign-in with a simple email form. The mode depends on the Flask.debug variable.

Configuration

  • FIREBASE_API_KEY: The API key.
  • FIREBASE_PROJECT_ID: The project identifier, eg. foobar.
  • FIREBASE_AUTH_SIGN_IN_OPTIONS: Comma-separated list of enabled providers.

Providers

  • email
  • facebook
  • github
  • google
  • twitter

Sample code

from flask import Flask, request
from flask_firebase import FirebaseAuth
from flask_login import LoginManager, UserMixin, login_user, logout_user
from flask_sqlalchemy import SQLAlchemy


app = Flask(__name__)
app.config.from_object(...)

db = SQLAlchemy(app)
auth = FirebaseAuth(app)
login_manager = LoginManager(app)

app.register_blueprint(auth.blueprint, url_prefix='/auth')


class Account(UserMixin, db.Model):

    __tablename__ = 'accounts'

    account_id = db.Column(db.Integer, primary_key=True)
    firebase_user_id = db.Column(db.Text, unique=True)
    email = db.Column(db.Text, unique=True, nullable=False)
    email_verified = db.Column(db.Boolean, default=False, nullable=False)
    name = db.Column(db.Text)
    photo_url = db.Column(db.Text)


@auth.production_loader
def production_sign_in(token):
    account = Account.query.filter_by(firebase_user_id=token['sub']).one_or_none()
    if account is None:
        account = Account(firebase_user_id=token['sub'])
        db.session.add(account)
    account.email = token['email']
    account.email_verified = token['email_verified']
    account.name = token.get('name')
    account.photo_url = token.get('picture')
    db.session.flush()
    login_user(account)
    db.session.commit()


@auth.development_loader
def development_sign_in(email):
    login_user(Account.query.filter_by(email=email).one())


@auth.unloader
def sign_out():
    logout_user()


@login_manager.user_loader
def load_user(account_id):
    return Account.query.get(account_id)


@login_manager.unauthorized_handler
def authentication_required():
    return auth.url_for('widget', mode='select', next=request.url)

More Repositories

1

mapbox-gl-js-offline-example

Sample vector tiles displayed with local copy of MapBox GL JS
HTML
235
star
2

vector-tiles-sample

Vector tiles sample MBTiles file with PBF's made by mapnik via MapBox Studio
CartoCSS
145
star
3

roman-empire

Map of the Roman Empire made with vector tiles
HTML
80
star
4

osmnames-sphinxsearch

Geocoder search engine for OSMNames.org data powered by sphinx search
Python
77
star
5

pdfium

PDFium library without V8 JavaScript engine - compiles under Linux, Mac and Windows
C++
54
star
6

iiifviewer

[DEPRECATED] IIIF WebGL / Canvas / DOM mobile-ready fast viewer powered by OpenLayers V3
JavaScript
54
star
7

klokantech-gl-fonts

Merged Google Noto fonts to provide glyphs for unicode OpenStreetMap labels in TileServer-GL
53
star
8

github-time-tracking

Add time tracking to the GitHub Issue Tracker with Harvest Platform.
JavaScript
52
star
9

openmaptiles-language

Javascript library for changing language of OpenMapTiles map in mapbox-gl-js
JavaScript
23
star
10

tileserver-gl-styles

Prebuilt map styles in GL JSON format for use in the TileServerGL and OpenMapTiles
18
star
11

jekylledit

Jekyll Visual Content Editor for Customers - WYSIWYG web administration / CMS for GitHub Pages website
JavaScript
17
star
12

embedr

Embedr.eu - Image Embedding Service (IES) with support for IIIF, OEmbed, zoomable viewer in an iFrame
Python
15
star
13

Apple-WWDC10-TileMap

Apple official iOS demo app for displaying gdal2tiles / MapTiler maps presented at WWDC 2010
Objective-C
15
star
14

osm-vector-cordova

OpenStreetMap vector tiles with native MapBox GL and Apache Cordova / PhoneGap Build
HTML
12
star
15

gl-style-package-spec

Best practice for storing "GL Styles" in a repo / directory / zip package
JavaScript
10
star
16

facebook-openid

Facebook OpenID Provider - allows to log in with Facebook account into any OpenID service, including Google AppEngine Federated Login
Python
10
star
17

omeka-plugin-IIIF

Omeka plugin for IIIF image service: used for thumbnails & zoomable viewer. Omeka also serves IIIF Presentation API manifest for use in Mirador or other tools.
PHP
9
star
18

tileserver-gl-data

DEPRECATED - Sample data and config for tileserver-gl
9
star
19

maptiler-ios-start

MapTiler iOS Start
Objective-C
8
star
20

cloudwrapper

Cloudwrapper - job queue, logging & metrics for Amazon, Google and private cloud
Python
6
star
21

bombard-docker

5
star
22

flask-backend

Asynchronous backend tasks for Flask
Python
5
star
23

postgres-docker

Docker image derived from official library image with PostGIS and pgcrypto extensions installed.
4
star
24

arcgis-js-vector-tiles-vtpk

Sample vector tile package generated by ArcGIS Pro
4
star
25

tippecanoe-docker

TippeCanoe on DockerHub
4
star
26

gdal_georeferencer

Creates GeoTIFF from a local image and metadata from Georeferencer.com online service
Python
4
star
27

omeka-s-docker

ApacheConf
4
star
28

omeka-docker

Classic omeka in docker
ApacheConf
4
star
29

supervisord-docker

Supervisord Docker
3
star
30

jpeg-opencl

Automatically exported from code.google.com/p/jpeg-opencl
C
3
star
31

cynefin

Cynefin Project
CSS
3
star
32

tilejson-ol3

OpenLayers implementation of TileJSON with custom projections
HTML
3
star
33

osm2vectortiles-ios-helloworld

Native iOS mobile application showing OSM2VectorTiles mapping data on iPad / iPhone
Objective-C
3
star
34

javascript

KlokanTech Standard JavaScript Library (JS)
JavaScript
3
star
35

sheets-preview

Offline spreadsheet preview Chrome App. Open binary files like XLS, XLSX, ODS (OpenOffice) directly with this JavaScript app, make basic editing and copy&paste to Google Sheets / Docs or a desktop software.
JavaScript
3
star
36

klokantech-gl-styles

Visual style for Klokantech Maps (GL JSON)
2
star
37

flask-fastspring

FastSpring API integration for Flask
Python
2
star
38

gdaldem_web

C
2
star
39

omeka-s-module-IIIFHosting

PHP
2
star
40

styles

KlokanTech Standard Style Library (CSS)
HTML
2
star
41

dare-raster-tiles

Digital Atlas of the Roman Empire - hosted raster tiles for use in vector map
HTML
2
star
42

proj4gl

Proj4GL is a GLSL shader code library for transforming point coordinates from one coordinate system to another, including datum transformations. This library is a port of popular PROJ.4 library to the shading language usable in both JavaScript and C/C++.
2
star
43

data.epsg.io

The regularly updated EPSG database available as OKNF DataPackage to track versions and exported as SQLite
1
star
44

nlsgb1900

NLS GB1900 gazetteer https://klokantech.github.io/nlsgb1900/
HTML
1
star
45

www.iiifhosting.com

Web of IIIF hosting
HTML
1
star
46

thumbnail-gl

Shell
1
star
47

dpkg-buildpackage-docker

Docker image for Debian dpkg-buildpackage with Python support - to create a .deb from python package
Python
1
star
48

nginx-docker

Nginx docker
Shell
1
star
49

bmarchives-tickets

BMArchives Request/Issue Tickets Tracker
1
star
50

flask-cron

Periodic task execution for Flask
Python
1
star
51

flask-mailgun

Mailgun integration for Flask
Python
1
star
52

search

Fulltext search service with JSON API implemented on top of SphinxSearch - to index Jekyll websites
Python
1
star
53

cdn.klokantech.com

KlokanTech CDN
JavaScript
1
star
54

pastplace

PastPlace responsive website design
HTML
1
star
55

proftpd-docker

ApacheConf
1
star
56

OS-Open-Zoomstack-Stylesheets

Cartographic stylesheets for OS Open Zoomstack
QML
1
star
57

scroll-story-map

Storytelling with a moving map while scrolling a page with text and photos
1
star
58

plugin-PDFOutput

The Omeka plugin providing PDF output format for item detail page /items/show?output=pdf
PHP
1
star
59

nls.tileserver.com

Static files on the free NLS API hosting
JavaScript
1
star