aj-r / RiotNet

A .NET/C# client for the Riot Games API
MIT License
22 stars 10 forks source link

is it possible to not call the riot api directly? #8

Closed ghost closed 7 years ago

ghost commented 8 years ago

is it possible to edit the wrapper so it doesnt call the riot api directly? so you can have a server in the middle with your api key on it, because right now the api key is hardcoded into the app and that way its not possible to release the app.

aj-r commented 8 years ago

I see... this API was designed to be called from a server, not from a client application.

I don't think you're allowed to set up a proxy server that just bypasses the API key anyways. I would recommend setting up a server that only does the exact functions that your client needs, and nothing more. You can use RiotNet in your server code (or a different library if you're not writing your server in C#). Then, assuming you're using C# for the client, use System.Net.Http.HttpClient to talk to your server.

morbalint commented 8 years ago

You can change the RiotClient.client.BaseUrl in the RiotClient constructor to point to your server and provide a fake API key. With that you can prefix all calls to your own server, but then you need to replicate all those API-s in your own server, and swap the API key to a real one.

The problem with the proxy server is that you still need to authenticate your own API calls or other people find it out and use your server for their calls. And if you already have a secure connection between your clients and your server, you only need 1 call: to get your API key (:

@aj-r i believe he wants this wrapper in the client code to use the Models, and the JSON parsing functions.

aj-r commented 7 years ago

If all you want is the models and JSON parsing, you don't need to change the BaseUrl. Just set up your own HttpClient that talks to your server, and deserialize using RiotNet models and Newtonsoft.Json.