임 현재 https://login.microsoftonline.com/XXX/oauth2/token 엔드 포인트로 게시물 요청을 보내어 애플리케이션의 액세스 토큰과 새로 고침 토큰을 검색하려고합니다. axios를 사용하여 포스트 요청을 엔드 포인트로 보낼 때 프리 플라이트는 송신되지 않지만 응답은 리턴되지 않습니다.Azure AD 프리 플라이트 요청에서 데이터를 반환하지 않습니다.
오류가 : 그러나 Axios의 POST 요청에 대한 다른 접근 방법을 사용하여
Response to preflight request doesn't pass access control check:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:3000' is therefore not allowed access.
, 데이터를 반환하지만 프리 플라이트가 없습니다와 다른 오류 제공 :
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:3000' is therefore not allowed access.
두 Axios의 요청을 :
const data = new FormData();
data.append('grant_type', this.config.grant_type);
data.append('client_id', this.config.client_id);
data.append('code', localStorage.getItem('auth_code'));
data.append('redirect_uri', this.config.redirect_uri);
data.append('client_secret', this.config.client_secret);
data.append('resource', this.config.client_id);
axios.post(`https://login.microsoftonline.com/${this.config.tenant}/oauth2/token`, data);
방법 2 :
,axios({
method: 'post',
contentType: 'application/json',
url: `https://login.microsoftonline.com/${this.config.tenant}/oauth2/token`,
data: {
grant_type: this.config.grant_type,
client_id: this.config.client_id,
code: localStorage.getItem('auth_code'),
redirect_uri: this.config.redirect_uri,
client_secret: this.config.client_secret,
resource: this.config.client_id
}
});
axios 요청 자체 또는 엔드 포인트에 문제가 있습니까?