diff --git a/api/auth_api.py b/api/auth_api.py index 805c62e..5e5fff6 100644 --- a/api/auth_api.py +++ b/api/auth_api.py @@ -136,7 +136,7 @@ def oidc(redirect_url=None): return response -@app.route('/refresh', methods=['POST']) +@auth_api_bp.route('/refresh', methods=['POST']) @jwt_refresh_token_required def refresh(): """Refresh token endpoint. This will generate a new access token from diff --git a/api/user_api.py b/api/user_api.py index 4c0aafd..ca727ef 100644 --- a/api/user_api.py +++ b/api/user_api.py @@ -22,6 +22,18 @@ user = api_user.model('User', { }) +@api_user.route('/profile', methods=['GET']) +class Profile(Resource): + @jwt_auth.login_required + @api_user.marshal_list_with(user) + def get(self): + """Get infos about logged in user.""" + current_user_id = get_jwt_identity() + app.logger.info(current_user_id) + return User.get_by_identifier(current_user_id) + + + @api_user.route('/') class UserList(Resource): """