Rock.Store.StoreService.AuthenicateUser C# (CSharp) Method

AuthenicateUser() public method

Authenicates the user.
public AuthenicateUser ( string username, string password, string &errorResponse ) : bool
username string The username.
password string The password.
errorResponse string The error response.
return bool
        public bool AuthenicateUser( string username, string password, out string errorResponse )
        {
            errorResponse = string.Empty;

            // url encode the password
            password = HttpUtility.UrlEncode( password );

            // setup REST call
            var client = new RestClient( _rockStoreUrl );
            client.Timeout = _clientTimeout;
            string encodedUserName = HttpUtility.UrlEncode( Convert.ToBase64String( Encoding.UTF8.GetBytes( username ) ) );
            string encodedPassword = HttpUtility.UrlEncode( Convert.ToBase64String( Encoding.UTF8.GetBytes( password ) ) );
            string requestUrl = string.Format( "api/Store/AuthenicateUser/{0}/{1}", encodedUserName, encodedPassword );
            var request = new RestRequest( requestUrl, Method.GET );

            // deserialize to list of packages
            var response = client.Execute<bool>( request );

            if ( response.ResponseStatus == ResponseStatus.Completed )
            {
                return response.Data;
            }
            else
            {
                errorResponse = response.ErrorMessage;
                return false;
            }
        }

Same methods

StoreService::AuthenicateUser ( string username, string password ) : bool