Javascript 如何在UberRUSH应用程序上设置源URL
我需要使用javascript从浏览器直接从webapp调用UberRUSH API。 我已经创建了一个开发者帐户和一个应用程序集来使用UberRUSH,但在应用程序仪表板中,我无法设置一个源URI来启用CORS 这就是我得到的错误:Javascript 如何在UberRUSH应用程序上设置源URL,javascript,jquery,uber-api,Javascript,Jquery,Uber Api,我需要使用javascript从浏览器直接从webapp调用UberRUSH API。 我已经创建了一个开发者帐户和一个应用程序集来使用UberRUSH,但在应用程序仪表板中,我无法设置一个源URI来启用CORS 这就是我得到的错误: XMLHttpRequest cannot load https://login.uber.com/oauth/v2/token. Response to preflight request doesn't pass access control check: N
XMLHttpRequest cannot load https://login.uber.com/oauth/v2/token.
Response to preflight request doesn't pass access control check: No
'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://localhost:3000' is therefore not allowed access.
不可能这样做吗?我需要使用服务器作为代理吗
我尝试过几种解决方案,但它们都是针对RidesAPI的,您可以在仪表板中设置一个源URI。e、 g
但什么都没用
这是我的代码:
$.ajax({
type: 'POST',
url: 'https://login.uber.com/oauth/v2/token',
contentType: 'x-www-form-urlencoded',
data: {
'client_id': '...my ID',
'client_secret': 'my Secret',
'grant_type': 'client_credentials',
'scope': 'delivery_sandbox' // I've tried with 'delivery' as well
},
dataType: 'json',
success: function(data){
console.log('success')
console.log(data);
console.log(m);
}
})
Rush API目前不支持CORS。谢谢您的回复。然后我会从服务器端打电话