【发布时间】:2016-05-25 15:31:34
【问题描述】:
我正在为我的移动应用程序使用 Yelp API。 Yelp API 需要 OAuth2 请求(消费者密钥、秘密密钥、令牌、秘密令牌)。如何使用 react native 发出请求?
【问题讨论】:
标签: javascript oauth-2.0 react-native
我正在为我的移动应用程序使用 Yelp API。 Yelp API 需要 OAuth2 请求(消费者密钥、秘密密钥、令牌、秘密令牌)。如何使用 react native 发出请求?
【问题讨论】:
标签: javascript oauth-2.0 react-native
您可以使用 fetch api 发出网络请求, 参考http://facebook.github.io/react-native/releases/0.26/docs/tutorial.html#fetching-real-data
请参阅 https://github.com/github/fetch 获取文档
fetch(apiUrl, options)
.then(function(response) {
return response.json()
}).then(function(json) {
console.log('parsed json', json)
}).catch(function(ex) {
console.log('parsing failed', ex)
})
【讨论】: