I had to do this in my create_app function-
with app.app_context():
app.auth = Auth(
app,
authority=os.getenv("AUTHORITY"),
client_id=os.getenv("CLIENT_ID"),
client_credential=os.getenv("CLIENT_SECRET"),
redirect_uri=os.getenv("REDIRECT_URI"),
)
And then make a wrapper decorator in my Blueprint:
def login_required(f):
"""Decorator to require login for a route."""
@wraps(f)
def decorated_function(*args, **kwargs):
return current_app.auth.login_required(f)(*args, **kwargs)
return decorated_function
I had to do this in my create_app function-
And then make a wrapper decorator in my Blueprint: