Authentication Parameters
CraigNavin opened this issue · 4 comments
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=*
These are set automatically by the wrapper.
Are you sure you have set the api key correctly?
I have my key in my strings file and create the wrapper like so:
APIWrapper wrapper = new APIWrapper(getApplicationContext(),String.valueOf(R.string.Apikey));
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.
That did the trick. Not sure why i didn't think it would return the int now i think about it.
Thanks