Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to provide credentials? #3

Open
kyaich211 opened this issue Oct 18, 2016 · 1 comment
Open

Way to provide credentials? #3

kyaich211 opened this issue Oct 18, 2016 · 1 comment

Comments

@kyaich211
Copy link

I have the same issue... need to get info from the HVAC system but how to pass credentials? Connect gets redirected to login page.

@vseven
Copy link

vseven commented Jan 15, 2020

I've been working on modifying this library to be a smaller DLL that I can then call from a VB.Net project and I think I've figured this out. In the XmlObixClient.cs file, under the public XmlObixClient, you need to add in some optional parameters for username and password then use them. Something like this:

        public XmlObixClient(Uri ObixLobbyUri, string userName = null, string password = null)
            : base(ObixLobbyUri)
        {
            System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
            System.Net.Http.Headers.AuthenticationHeaderValue authHeader = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(encoding.GetBytes(string.Format("{0}:{1}", userName, password))));
            
            WebClient = new HttpClient();
            WebClient.DefaultRequestHeaders.Authorization = authHeader;
            ErrorStack = new ObixErrorStack();

        }

This got me by the default "Unknown Error: 7" I kept getting although now I'm getting a "The XML parser could not understand the XML document provided" issue....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants