Cannot build url for 'logout' when using dynamic client registration
Closed this issue · 0 comments
If the logout view is mounted under a custom endpoint (other than the default, which is the name of the view function), or if using Blueprints, you must specify the full URL in the Flask-pyoidc configuration using
post_logout_redirect_uris
.
This is working as intended but when using dynamic client registration these methods are called:
Flask-pyoidc/src/flask_pyoidc/flask_pyoidc.py
Lines 95 to 97 in b0058c0
Flask-pyoidc/src/flask_pyoidc/flask_pyoidc.py
Lines 84 to 85 in b0058c0
self._logout_view.__name__
returns the name of the view function. url_for
uses the route registration to find the route registered against that name. If the view function is mounted at blueprint, its name is prefixed by the name of the blueprint so providing only __name__
to url_for
is not enough.
blueprint = Blueprint('api', __name__, url_prefix='/api/v1')
@blueprint.route('/logout')
def logout():
return 'You have been logged out'
print(url_for('api.logout'))
# http://localhost:5000/api/v1/logout
print(url_for('logout'))
# Cannot build url for 'logout'. Did you mean 'api.logout'?
.get()
will always call that method to set default value even if post_logout_redirect_uris
is provided as an argument.