0
votes

I have implemented CredentialsAuthProvider authentication in ServiceStack.As a result of which i am able to create UserAuth and UserOAuthProvider tables into my RDBMS. Also i have written Service to register User. Now When i am trying to test my authentication using http://localhost:64132/auth/credentials URL i am able to do it. Also i am getting a response like

{
"SessionId": "1",
"UserName": "Bond",
"ResponseStatus": {}
}

Now as per my requirement i have to Consume this 'http://localhost:64132/auth/credentials' through my Login Service and get the response . On Successful authentication i want my Login Service to redirect to a Home.html page. Please help me to get it .I for the first time working on ServiceStack framework.Thanks

Update..

public class LoginService: Service {

        public Object Any(Login loginRequest) {

        //Here at this point call the Authentication URL from c# Client Service

        loginRequest.UserName = "Bond";
        loginRequest.Password = "password";

        string BaseUrl = "http://localhost:64132/auth";

        var client = new JsonServiceClient(BaseUrl);

        string response="";

        try
        {
            var authResponse = client.Send<AuthResponse>(new Auth
            {
                provider = CredentialsAuthProvider.Name,
                UserName = loginRequest.UserName,
                Password = loginRequest.Password,
                RememberMe = true,  //important tell client to retain permanent cookies
            });

            response = authResponse.ToString();
        }
        catch (Exception ex) { 

        }
1

1 Answers

1
votes

I've already answered this question for you in this previous answer listing each of the Redirect options, e.g you can use the ?Continue=/Home Request parameter when you authenticate.