Ajax Django Login/Authentication without re-direct

前端 未结 2 816
暗喜
暗喜 2021-01-15 15:54

I am trying to have an authentication set-up similar to that of StackOverflow, where the normal browsing is never affected unless there are some privileged actions which req

2条回答
  •  无人及你
    2021-01-15 16:05

    The approach I use is to have a Tastypie api layer and require authentication for the APIs. If the API call fails because of authentication, the client can request the user to log-in via the ajax login method.

    You can log-in a user via ajax using this gist

提交回复
热议问题