在postman中,他们的类型授权称为Api Key
,它提供了三个参数:Key
、Value
和Add to
。
我已经设置了Key to SECRET_KEY
、VALUE to sdsfdsfsdf3343
和Add to: Headers
这成功地在我的后台工作,我能够获得他们的价值。
如何从我的应用程序中将此Api密钥设置为header,如何在javascript react-native应用程序中添加带有键值的authorization header
发布于 2020-02-18 02:40:12
你是说像这样的东西吗?
fetch('https://mywebsite.com/endpoint/', {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
Key: 'sdsfdsfsdf3343' <------------ Put your key here?
},
body: JSON.stringify({
firstParam: 'yourValue',
secondParam: 'yourOtherValue',
}),
});
发布于 2020-09-10 11:40:00
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
SECRET_KEY: 'sdsfdsfsdf3343'
}
https://stackoverflow.com/questions/60272936
复制相似问题