Using A custom Authentication With Tornado Request handler

I am trying to authenticate users with custom authentication using --auth-module cli flag using something like below

import tornado
from tornado.web import RequestHandler
def get_user(request_handler):
    return request_handler.get_cookie("user")
login_url = "/login"

class LoginHandler(RequestHandler):

    def get(self):
        try:
            errormessage = self.get_argument("error")
        except Exception:
            errormessage = ""
        if self.get_cookie('user'):
             self.redirect("http://localhost/login")##This url is a part of separate vue.js app

    def check_permission(self):
        user = self.get_cookie("user")
        if user:
            return True
        return False

    def post(self):
        auth = self.check_permission()
        if auth:
            self.redirect("http://localhost:5006/bokeh/bkapp")##TO be noted i have a path prefix added to my bokeh server apps
        else:
            self.redirect("http://localhost/login")##This url is a part of separate vue.js app

    def set_current_user(self, user):
        if user:
            self.set_cookie("user", tornado.escape.json_encode(user))
        else:
            self.clear_cookie("user")

# optional logout_url, available as curdoc().session_context.logout_url
logout_url = "/logout"

# optional logout handler for logout_url
class LogoutHandler(RequestHandler):

    def get(self):
        self.clear_cookie("user")
        self.redirect("http://localhost/login")

So a user has to pass through a vue.js login page and if authenticated is redirected to my bokeh app,but if the bokeh app browser’s cookie is not set some how the user has to be redirected to my vue.js login page i.e. “http://localhost/login”…but tornado searches for /login in the bokeh server itself and user is redirected to a login url that looks something like–>
(http://localhost:5006/login?next=%2Fbokeh%2Fbkapp)

It’s not really clear what this means, you will need to explain in more detail and steps exactly what is occurring (screenshots would probably also help).