Nikey646 / VndbSharp

A C# Vndb API Library. #OriginalNamingScheme
MIT License
18 stars 4 forks source link

Add documentation on how to log into the API #35

Closed micah686 closed 7 years ago

micah686 commented 7 years ago

Could you please add an example of how you would log into the API? There isn't any example in the Program.cs how you would log into the API. I see that there is a lot of #if UserAuth to check if the user has authenticated, but I can't figure out how you would initially authenticate.

Nikey646 commented 7 years ago

This is an example, that assumes the application is a console window.

The this.GetUsernameAndPassword method is just a helper method further down in the file that reads the input from the console, while also masking the input (rather poorly) for the password.

The UserAuth directive is due to the fact that by default VndbSharp doesn't build with support for logging in because of security issues.

micah686 commented 7 years ago

The issue I'm encountering is that Vndb.cs has a #if UserAuth for the overloaded Vndb(), so if I were to try this._client = new Vndb(username, secureStringPassword), it would give an error about Vndb not having 2 overloads.

Nikey646 commented 7 years ago

Yes, because login is disabled by default, you need to provide the UserAuth defines when compiling VndbSharp to enable the methods that do username/password logins.

micah686 commented 7 years ago

@Nikey646 So how would you enable UserAuth on the project when compiling on Visual Studio

Nikey646 commented 7 years ago

In the properties section, under build you add UserAuth to the Conditional Compilation Symbols textbox.

Nikey646 commented 7 years ago

This appears to be resolved, so i'm going to close it. Feel free to reopen it if you considering otherwise.