내 laravel 응용 프로그램에서 내 ionic 2 응용 프로그램에 oauth 토큰을 가져 오려고합니다.하지만 오류가 발생했습니다. 그것을 해결하는 방법? 브라우저에서 정상적으로 작동하지만 에뮬레이션 할 때 작동하지 않습니다.Axios 게시물 요청이 이온 2에서 작동하지 않습니다
Login.ts (이온) 내가 무엇을 가지고
getLogin(event) {
oauth_credentials.username = '[email protected]';
oauth_credentials.password = 'secret';
axios.post(route.oauth_token, JSON.stringify(oauth_credentials),
{headers: {'Content-Type': 'application/json'}})
.then(res => {
console.log(res)
this.selectedItem = res.data;
})
.catch(err => {
console.log(err.data)
this.selectedItem = 'err';
})
}
오류가 발생했습니다. 그것을 고치는 방법?
oauth 토큰을 요청하면 자동으로 OPTIONS 요청을 보내고 내 에뮬레이터가 오류로 요청하는 이유는 무엇입니까? 브라우저가 그런 식으로 작동하지 않습니다. –
제안 사항을 사용하지만 같은 오류보기 –