如何将此 paypal curl 命令转换为 Axios?
\n\ncurl -v https://api.sandbox.paypal.com/v1/oauth2/token \\\n-H "Accept: application/json" \\\n-H "Accept-Language: en_US" \\\n-u "client_id:secret" \\\n-d "grant_type=client_credentials"\nRun Code Online (Sandbox Code Playgroud)\n\n我在 vue 中使用 vueAxios,因此是“ this. ”。
\n\nthis.axios.post(\'https://api.sandbox.paypal.com/v1/oauth2/token\',\n {\'Accept\': "application/json", \'Accept-Language\': "en_US", \n \'XXXXXX\': \'XXXXX\', // my paypal client ID and client secret \n \'grant_type\':\'client_credentials\'}\n )\n .then( response => {\n console.log("Response is: ", response);\n })\n .catch( error => {\n console.log("Error is :", error);\n});\nRun Code Online (Sandbox Code Playgroud)\n\n我收到此错误:
\n\n Error is : Error: Request failed with status code 401\n at createError (createError.js?16d0:16)\n at …Run Code Online (Sandbox Code Playgroud)