【发布时间】:2020-04-02 00:12:49
【问题描述】:
【问题讨论】:
标签: api react-native woocommerce axios
【问题讨论】:
标签: api react-native woocommerce axios
你可以使用axios-oauth-1.0a向Axios添加拦截器
示例代码:
import axios from 'axios';
import addOAuthInterceptor from "axios-oauth-1.0a";
// Create a client whose requests will be signed
const client = axios.create();
// Add interceptor that signs requests
addOAuthInterceptor(client, {
// OAuth consumer key and secret
key: "xxx",
secret: "yyy",
// HMAC-SHA1 and HMAC-SHA256 are supported
algorithm: "HMAC-SHA1",
});
// Now send requests to the OAuth 1.0a service using that client
【讨论】: