Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
React/Flask google oauth2 problem

Hello, i am trying to implement google oauth2 in my flask/react app, and my problem is that my session cookies are lost after i redirect(in the callback route) to my frontend page. I would like to know any way to work around it or if you know about better option how to implement google oauth. Thank you.

Relevant code:

clientsecretsfile = os.path.join(pathlib.Path(file).parent, "clientsecret.json")

flow = Flow.from
clientsecretsfile(
clientsecretsfile=clientsecretsfile,
scopes="https://www.googleapis.com/auth/userinfo.profile", "https://www.googleapis.com/auth/userinfo.email", "openid",
redirecturi="http://127.0.0.1:5000/callback"
)

def login
isrequired(function): #a function to check if the user is authorized or not
def wrapper(*args, **kwargs):
print(session)
if "google
id" not in session: #authorization required
return abort(401)


/r/flask
https://redd.it/zpajdn