User authentication in tornado websocket application

后端 未结 2 1506
花落未央
花落未央 2021-02-04 13:51

Now, i improve my tornado skills and have a question about user auth.

And my solution is create secure token on first page and next send it with other data, from javascr

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 14:30

    I suggest you read the overview section in the documentation.

    There should be some relevant content there:

    • Cookies and secure cookies
    • User Authentication
    • Third Party Authentication

    EDIT

    I just realized your question is about websockets. I believe you can use the approach you outline:

    • Create a cookie in the non-websocket part of your app
    • Check the cookie in the websocket handler

    You should be able to access the request headers inside the websocket handler using self.request.headers.

提交回复
热议问题