Closed sofist-lucaskatayama closed 10 years ago
Hi In my app, I needed a X-Token header with the api key. So I made a change in your code to have this config
"auth" : { "key" : { "param" : "X-Token", "location" : "header" } }
_app.js 939_
if(checkObjVal(apiConfig,'auth','key','location').exists){ location = checkObjVal(apiConfig,'auth','key','location').value; } // Add API Key to params, if any. if (apiKey != '' && apiKey != 'undefined' && apiKey != undefined) { if(location == 'header'){ options.headers[apiConfig.auth.key.param] = apiKey; } else{ if (options.path.indexOf('?') !== -1) { options.path += '&'; } else { options.path += '?'; } console.log(apiConfig.auth.key.param); options.path += apiConfig.auth.key.param + '=' + apiKey; } }
So if this is useful for you. Please make it permanent.
:+1: Thanks for posting this. Exactly what I needed.
Thanks for this - this is also exactly what I needed
looks like a version of this was just merged to master with PR 224 :)
https://github.com/mashery/iodocs/pull/224/files
Nice =) Tnx
Hi In my app, I needed a X-Token header with the api key. So I made a change in your code to have this config
_app.js 939_
So if this is useful for you. Please make it permanent.