Szymon Rozga
Szymon Rozga

Reputation: 18178

ServiceStack CredentialsAuthProvidercheck if authenticated

Is there an easy way I can easily check whether I am currently logged into ServiceStack Auth by using a REST endpoint?

Upvotes: 1

Views: 46

Answers (1)

Scott
Scott

Reputation: 21521

ServiceStack v4 has been recently updated, Friday 16 May, (in this commit) to support returning session information by making a GET request to the Authenticate route /auth.

Session

Thus if you have a valid session you will get a response such as:

{
    "UserId":"1",
    "SessionId":"1",
    "UserName":"bob",
    "ResponseStatus":{}
}

Otherwise you can always create a service that returns information about your session yourself. See my other answer for an example of this method.

Hope that helps.

Upvotes: 3

Related Questions