twitchtv / api-android-java

Java Wrapper for android, IGDB.com API. Requires an API key. Get one at:
https://api.igdb.com/
MIT License
14 stars 13 forks source link

Authentication Parameters #2

Closed CraigNavin closed 6 years ago

CraigNavin commented 6 years ago

Just getting started with this api today. Unfortunatly i have encountered a 403 response error. When i follow the link it says that the authentication parameters are missing. I know that means my user key and an accept header with value application/json. Do i need to input these somewhere manually or is there an issue?

E/Volley: [208] BasicNetwork.performRequest: Unexpected response code 403 for https://api-2445582011268.apicast.io/games/?search=Zelda?fields=*

husnjak commented 6 years ago

These are set automatically by the wrapper. Are you sure you have set the api key correctly?

CraigNavin commented 6 years ago

I have my key in my strings file and create the wrapper like so: APIWrapper wrapper = new APIWrapper(getApplicationContext(),String.valueOf(R.string.Apikey));

husnjak commented 6 years ago

The problem lies in your code: String.valueOf(R.string.Apikey)

Using String.ValueOf does not return the api key but the int that R.string.Apikey is represented by.

Try using getResources().getString(R.string.api_key), this will return the string you are looking for.

CraigNavin commented 6 years ago

That did the trick. Not sure why i didn't think it would return the int now i think about it. Thanks