-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68c76ee
commit 10cb362
Showing
7 changed files
with
83 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from flask import Flask, redirect, url_for | ||
from flask_dance.contrib.google import make_google_blueprint, google | ||
|
||
from src.config import config_instance | ||
|
||
app = Flask(__name__) | ||
app.secret_key = config_instance().SECRET_KEY | ||
|
||
google_dance = make_google_blueprint(client_id=config_instance().GOOGLE_SETTINGS.GOOGLE_CLIENT_ID, | ||
client_secret=config_instance().GOOGLE_SETTINGS.GOOGLE_CLIENT_SECRET, | ||
scope=["profile", "email"]) | ||
|
||
|
||
@google_dance.route("/login/google") | ||
def login_google(): | ||
if not google.authorized: | ||
return redirect(url_for("google.login")) | ||
resp = google.get("/oauth2/v2/userinfo") | ||
assert resp.ok, resp.text | ||
return "You are {email} on Google".format(email=resp.json()["email"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters