且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

不工作Servicestack用户会话

更新时间:2023-08-17 16:39:28

有关基本认证哪里凭据是在它的预期每个请求发送。

For Basic Auth where the credentials are sent on each request it's expected.

为了为ServiceClient保留已经验证,你应该设置与rememberMe 标志时您进行验证,例如使用 CredentialsAuthProvider :

In order for the ServiceClient to retain the Session cookies that have been authenticated you should set the RememberMe flag when you authenticate, e.g using CredentialsAuthProvider:

var client = new JsonServiceClient(BaseUrl);
var authResponse = client.Send(new Authenticate {
    provider = "credentials", 
    UserName = "user",
    Password = "p@55word",
    RememberMe = true,
});

幕后这背后附加的用户会话的 SS-PID 饼干(永久会话Cookie),其中客户端保留并重新发送对从ServiceClient实例。

Behind the scenes this attaches the user session to the ss-pid cookie (permanent session cookie), which the client retains and resends on subsequent requests from that ServiceClient instance.