Implement OAuth2 on the backend with Gitlab as a provider
The idea is to redirect all unauthenticated requests to /login which initiates oauth. Authentication is tracked via Flask-Login. A user is considered to be authorized when the "login_user" function is called. The @login_required decorator can be used to prevent unauthenticated users from accessing routes. Once the oauth provider returns successfully, login_user is called and the user is redirected back to /
Edited by Anton Akhmerov