I think you're problems stem from trying to merge 2 completely independent authentication providers. i.e. ServiceStack Auth doesn't rely-on/touch
ASP.NET Authentication and vice-versa.
The AccountController in SocialBootstrap API is a red-herring it was automatically created with the MVC
VS.NET template and was just left as-is, i.e. it's
not used in any way in the SocialBootstrapApi demo.
The documentation for ServiceStack's Authentication is at:
In order to Authenticate you need to call the ServiceStack AuthService which by default is made available at: /auth/{provider}
So to Authenticate with a UserName/Password you would send a HTTP Request like:
POST localhost:60339/auth/credentials
Content-Type: application/json
{
"UserName": "admin",
"Password": "test"
"RememberMe": true
}
Note: The RememberMe flag is what tells ServiceStack to store the users session against the the 'ss-pid' (PermanentSessionId).
When you Authenticate the service all ServiceStack does is loads the Users Session and stores it against the SessionId which is also returned in the AuthReponse DTO.
The AuthService automatically (if its not done already done so) tells the HTTP client to store the ss-id and ss-pid cookies which contains the Users SessionId.
The source code for the AuthService which includes the Auth and AuthReponse DTOs is available at:
There are 2 primary hooks where you can add custom AuthLogic. If you're implementing your own CustomAuthProvider you can override the AuthProvider.OnAuthenticated() method:
Which will be invoked when a user has Authenticated with that particular AuthProvider.
Otherwise if you implement a CustomUserSession you can implement its AuthUserSession.OnAuthenticated() method which will get called whenever a User is Authenticated with any of the registered AuthProviders.
The example from SocialBootstrapApi uses this to execute Post Auth tasks like extract the UserSession data, set the users Gravatar Url and extract any Twitter or Facebook AuthInfo into its own custom User db table (separate from SS):
There are 2 ways SocialBootstrapApi authenticates with ServiceStack, via the Registration service:
It uses the url from the HTML form which is at /api/register
This calls the built-in Registration service here:
Which if AutoLogin is set to true, will auto authenticate the user (in the same request) after a successful registration:
SocialBootstrapApi also allows the user to sign-in manually using a UserName/Password against the CredentialsAuthProvider which it does at:
<a href="@Url.Content("~/api/auth/facebook")"><img src="@Url.Content("~/Content/img/sign-in-with-facebook.png")" alt="Sign-in with Facebook" /></a>
</div>
<div id="twitter-signin">
<a href="@Url.Content("~/api/auth/twitter")"><img src="@Url.Content("~/Content/img/sign-in-with-twitter-l.png")" alt="Sign-in with Twitter" /></a>
</div>
Which either starts off at the FacebookAuthProvider /api/auth/facebook or the TwitterAuthProvider at /api/auth/twitter
Hope this explains things clearer.
Cheers,