I am using Flask-Dance to integrate Google login/signup into my app having two different roles i.e. patient and staff. I had created different login/signup routes for them. The issue I am facing right now is passing role to my callback route so I can set it in DB. In my signup route, I am creating the URL like this:
google_signup_link = url_for('google.login', next=url_for('main.google_login', _external=True), role=PATIENT)
I am configuring my Google blueprint like this:
google_blueprint = make_google_blueprint(
client_id=secrets['google']['client_id'],
client_secret=secrets['google']['client_secret'],
scope=['openid', 'email', 'profile'],
redirect_to='main.google_login'
)
app.register_blueprint(google_blueprint, url_prefix='/google_login')
But, when I try to access the role parameter in my callback function it is not found hence I end up setting the role to None. Here is my callback route:
@main.route('/google-login')
def google_login():
role = request.args.get('role')
I would appreciate the help in passing the role in the callback route without storing it in session or anywhere. Thanks!