在我的离子应用程序中访问jhipsterOauth2API时但没有得到任何响应。这是我从离子应用发送的$http请求
$http({
method: "post",
url: "http://192.168.0.5:8080/auth-2-sconnect/oauth/token",
data: "username=admin&password=admin&grant_type=password&scope=read write&client_secret=my-secret-token-to-change-in-production&client_id=auth2Sconnectapp",
withCredentials: true,
headers: {
'Accept':'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.success(function(data) {
alert("success: " + data);
})
.error(function(data, status) {
alert("ERROR: " + data);
});
如果我插入,它也会给出**Status Code:403 Forbidden**
错误
'Authorization': 'Basic ' + 'YXV0aDJTY29ubmVjdGFwcDpteS1zZWNyZXQtdG9rZW4tdG8tY2hhbmdlLWluLXByb2R1Y3Rpb24='
内部标头
我在jhipster应用程序的application.yml中取消了对CORS的评论,这似乎起到了作用。
我的离子应用程序现在运行良好。