使用axios在同一站点上单独的身份验证会话

时间:2018-06-27 22:21:33

标签: javascript authentication browser xmlhttprequest axios

我正在尝试开发一个登录网站的应用程序(通过表单,因此没有任何JTW或类似内容)。我必须能够使用axios在同一浏览器实例中登录多个用户。 示例:

var userOne = FormLogin{
    username: 'usernameOne',
    password: 'passwordOne'
}

var userTwo = new FormLogin{
    username: 'usernameTwo',
    password: 'passwordTwo'
}

var userOneAuth = userOne.login();
var userTwoAuth = userTwo.login();

// In the same page
console.log(userOneAuth.info()); // Should output the info of the first user making a request with it's own authentication.
console.log(userOneAuth.info()); // Should output the info of the second user making a request with it's own authentication.

// This must happen in the same browser page

如何使用Axios(浏览器端)实现这一目标?

0 个答案:

没有答案